signed char and unsigned char can be initialized with string constants too
authorMatthias Braun <matze@braunis.de>
Tue, 22 Jan 2008 22:26:00 +0000 (22:26 +0000)
committerMatthias Braun <matze@braunis.de>
Tue, 22 Jan 2008 22:26:00 +0000 (22:26 +0000)
[r18844]

parser.c

index 752d000..0864933 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -963,9 +963,12 @@ static initializer_t *initializer_from_expression(type_t *type,
                type_t       *const element_type = skip_typeref(array_type->element_type);
 
                if (element_type->kind == TYPE_ATOMIC) {
+                       atomic_type_kind_t akind = element_type->atomic.akind;
                        switch (expression->kind) {
                                case EXPR_STRING_LITERAL:
-                                       if (element_type->atomic.akind == ATOMIC_TYPE_CHAR) {
+                                       if (akind == ATOMIC_TYPE_CHAR
+                                                       || akind == ATOMIC_TYPE_SCHAR
+                                                       || akind == ATOMIC_TYPE_UCHAR) {
                                                return initializer_from_string(array_type,
                                                        &expression->string.value);
                                        }