diff --git a/gcc/gcc/c/c-typeck.c b/gcc/gcc/c/c-typeck.c index 5838d6a721..a1d38b7548 100644 --- a/gcc/gcc/c/c-typeck.c +++ b/gcc/gcc/c/c-typeck.c @@ -6553,7 +6553,7 @@ digest_init (location_t init_loc, tree type, tree init, tree origtype, if (char_array) { - if (typ2 != char_type_node) + if (typ2 != char_type_node && typ2 != unsigned_char_type_node) { error_init ("char-array initialized from wide string"); return error_mark_node; @@ -6561,7 +6561,7 @@ digest_init (location_t init_loc, tree type, tree init, tree origtype, } else { - if (typ2 == char_type_node) + if (typ2 == char_type_node || typ2 == unsigned_char_type_node) { error_init ("wide character array initialized from non-wide " "string"); diff --git a/gcc/gcc/cp/typeck2.c b/gcc/gcc/cp/typeck2.c index 0bdad2a51f..df34aea9ee 100644 --- a/gcc/gcc/cp/typeck2.c +++ b/gcc/gcc/cp/typeck2.c @@ -970,7 +970,7 @@ digest_init_r (tree type, tree init, bool nested, int flags, if (TYPE_PRECISION (typ1) == BITS_PER_UNIT) { - if (char_type != char_type_node) + if (char_type != char_type_node && char_type != unsigned_char_type_node) { if (complain & tf_error) error ("char-array initialized from wide string"); @@ -979,7 +979,7 @@ digest_init_r (tree type, tree init, bool nested, int flags, } else { - if (char_type == char_type_node) + if (char_type == char_type_node || char_type == unsigned_char_type_node) { if (complain & tf_error) error ("int-array initialized from non-wide string");