skip_typeref().
authorChristoph Mallon <christoph.mallon@gmx.de>
Thu, 2 Oct 2008 18:56:14 +0000 (18:56 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Thu, 2 Oct 2008 18:56:14 +0000 (18:56 +0000)
[r22421]

parser.c
type_t.h

index 461c62c..16541f0 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -8781,7 +8781,7 @@ static statement_t *parse_case_statement(void)
                /* This check does not prevent the error message in all cases of an
                 * prior error while parsing the expression.  At least it catches the
                 * common case of a mistyped enum entry. */
-               if (is_type_valid(expression->base.type)) {
+               if (is_type_valid(skip_typeref(expression->base.type))) {
                        errorf(pos, "case label does not reduce to an integer constant");
                }
                statement->case_label.is_bad = true;
index 894270d..becc8a0 100644 (file)
--- a/type_t.h
+++ b/type_t.h
@@ -262,6 +262,7 @@ static inline bool is_type_compound(const type_t *type)
 
 static inline bool is_type_valid(const type_t *type)
 {
+       assert(!is_typeref(type));
        return type->kind != TYPE_ERROR;
 }