typeck.c (build_modify_expr): The pedwarn for array assignment is now unconditional.
authorJason Merrill <jason@redhat.com>
Thu, 25 Apr 2002 00:13:45 +0000 (20:13 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 25 Apr 2002 00:13:45 +0000 (20:13 -0400)
        * typeck.c (build_modify_expr): The pedwarn for array assignment is
        now unconditional.
        * tree.c (build_cplus_array_type_1): Still process simple array types
        normally in templates.

From-SVN: r52746

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/cp/typeck.c
gcc/testsuite/g++.old-deja/g++.benjamin/14664-1.C
gcc/testsuite/g++.old-deja/g++.benjamin/14664-2.C
gcc/testsuite/g++.old-deja/g++.pt/crash51.C

index e4ca0591d510994a9e43345759401b440882c9a6..ef5faf451b03ff78d028ae6fbb43dd2fab1d9136 100644 (file)
@@ -19,6 +19,9 @@
        PR c++/6331
        * method.c (do_build_copy_constructor): Use cp_build_qualified_type.
        * typeck.c (build_modify_expr): Allow arrays to differ in cv-quals.
+       The pedwarn for array assignment is now unconditional.
+       * tree.c (build_cplus_array_type_1): Still process simple array types
+       normally in templates.
 
        PR c++/6395
        * decl.c (make_rtl_for_nonlocal_decl): Don't mess with #pragma i/i
index ff3e633302bc6ebb219a756c4e006259875c5dd4..cdf9d7509baf2dbc5d34541f5d113a8a71d61ec8 100644 (file)
@@ -463,7 +463,12 @@ build_cplus_array_type_1 (elt_type, index_type)
   if (elt_type == error_mark_node || index_type == error_mark_node)
     return error_mark_node;
 
-  if (processing_template_decl 
+  /* Don't do the minimal thing just because processing_template_decl is
+     set; we want to give string constants the right type immediately, so
+     we don't have to fix them up at instantiation time.  */
+  if ((processing_template_decl
+       && index_type && TYPE_MAX_VALUE (index_type)
+       && TREE_CODE (TYPE_MAX_VALUE (index_type)) != INTEGER_CST)
       || uses_template_parms (elt_type) 
       || uses_template_parms (index_type))
     {
index 10db2f84b3a0c2136e4603d04c79bac779060dc7..a1050bb7596ecaea4374ce90693d2b4a62ae0721 100644 (file)
@@ -5674,7 +5674,7 @@ build_modify_expr (lhs, modifycode, rhs)
        }
 
       /* Allow array assignment in compiler-generated code.  */
-      if (pedantic && ! DECL_ARTIFICIAL (current_function_decl))
+      if (! DECL_ARTIFICIAL (current_function_decl))
        pedwarn ("ISO C++ forbids assignment of arrays");
 
       from_array = TREE_CODE (TREE_TYPE (newrhs)) == ARRAY_TYPE
index b5dc839f884796caea4b6d933291bc417dff575b..e3f2bfbe526ccaa200b25e68da51c13c3d4df139 100644 (file)
@@ -1,7 +1,6 @@
 // 981203 bkoz
 // g++/14664 - test
 // Build don't link: 
-// Special g++ Options: -fconst-strings
 
 char foo[26];
 
index 35dc0b2f6add14217d09353942168443478b0957..9c5dade4d84e4f7e54f9a5d51cce6942252d635a 100644 (file)
@@ -1,7 +1,7 @@
 // 981203 bkoz
 // g++/14664 + test
 // Build don't link: 
-// Special g++ Options: -fno-const-strings
+// Special g++ Options: -fpermissive -w
 
 char foo[26];
 
index b7687d3969a00e40365227a2c9729e9891d34779..3f547e598add968497419a369b558e2148388bff 100644 (file)
@@ -1,5 +1,5 @@
 // Build don't link:
-// Special g++ Options: -fno-const-strings
+// Special g++ Options: -fpermissive -w
 // Origin: Mark Mitchell <mark@codesourcery.com>
 
 char foo[26];