From: Mark Mitchell Date: Mon, 21 Oct 2002 16:47:14 +0000 (+0000) Subject: decl.c (reshape_init): Tweak handling of character arrays. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=42328048677b6e6dbc601b36dd0ee8909eb68f91;p=gcc.git decl.c (reshape_init): Tweak handling of character arrays. * decl.c (reshape_init): Tweak handling of character arrays. * g++.dg/init/array6.C: Add additional tests. From-SVN: r58363 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 350b016411f..74e5ef3b8a8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,7 @@ 2002-10-21 Mark Mitchell + * 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. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e936765de3a..b52622a03a8 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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] diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e19f41d88d9..f2d02a3433c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2002-10-21 Mark Mitchell + + * g++.dg/init/array6.C: Add additional tests. + 2002-10-21 Ulrich Weigand * gcc.dg/weak/typeof-2.c: Handle s390x targets as well. diff --git a/gcc/testsuite/g++.dg/init/array6.C b/gcc/testsuite/g++.dg/init/array6.C index 1b04709cb92..6181d02bfd2 100644 --- a/gcc/testsuite/g++.dg/init/array6.C +++ b/gcc/testsuite/g++.dg/init/array6.C @@ -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" };