decl.c (reshape_init): Tweak handling of character arrays.
authorMark Mitchell <mark@codesourcery.com>
Mon, 21 Oct 2002 16:47:14 +0000 (16:47 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Mon, 21 Oct 2002 16:47:14 +0000 (16:47 +0000)
* decl.c (reshape_init): Tweak handling of character arrays.

* g++.dg/init/array6.C: Add additional tests.

From-SVN: r58363

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/init/array6.C

index 350b016411f1c3f5aa7a029fdbc70ab119286c0d..74e5ef3b8a8d2c65a59a3e42bc1db17aaab4bd7f 100644 (file)
@@ -1,5 +1,7 @@
 2002-10-21  Mark Mitchell  <mark@codesourcery.com>
 
+       * decl.c (reshape_init): Tweak handling of character arrays.
+
        PR c++/8218
        * cp-tree.h (lang_type_class): Add contains_empty_class_p.
        (CLASSTYPE_CONTAINS_EMPTY_CLASS_P): New macro.
index e936765de3a9ce22d04cfd945fc3f4a874a8525a..b52622a03a8234b9c99d0fb4b9e6393a8f8e42e2 100644 (file)
@@ -7838,7 +7838,7 @@ reshape_init (tree type, tree *initp)
 
   if (TREE_CODE (old_init_value) == STRING_CST
       && TREE_CODE (type) == ARRAY_TYPE
-      && char_type_p (TREE_TYPE (type)))
+      && char_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (type))))
     {
       /* [dcl.init.string]
 
index e19f41d88d9a61bad6ce3b95bccf83b4841129f0..f2d02a3433c5e510932d5f1057e201e7c57cfe7d 100644 (file)
@@ -1,3 +1,7 @@
+2002-10-21  Mark Mitchell  <mark@codesourcery.com>
+
+       * g++.dg/init/array6.C: Add additional tests.
+
 2002-10-21  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * gcc.dg/weak/typeof-2.c: Handle s390x targets as well.
index 1b04709cb92e44088198572b0bc47d45acc24726..6181d02bfd23dfc56af21c8cbccb10eaa6525395 100644 (file)
@@ -1,3 +1,7 @@
 // { dg-do compile }
 
 char arr [][4] = { "one", "two" };
+const char arr2[][4] = { "one", "two" };
+signed char arr3[][4] = { "one", "two" };
+const unsigned char arr4[][4] = { "one", "two" };
+volatile wchar_t arr5[][4] = { L"one", L"two" };