From 2564aaa12c92e188f748ae59b7aae58c0c1dc4bd Mon Sep 17 00:00:00 2001 From: acqn Date: Wed, 10 Jan 2024 04:48:27 +0800 Subject: [PATCH] Refix for diagnosis on expected expressions. --- src/cc65/expr.c | 2 +- test/ref/bug1889-missing-identifier.c | 2 ++ test/ref/bug1889-missing-identifier.cref | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cc65/expr.c b/src/cc65/expr.c index 0f3a6e110..3ef141300 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -1408,7 +1408,7 @@ static void Primary (ExprDesc* E) } else { /* Let's see if this is a C99-style declaration */ DeclSpec Spec; - ParseDeclSpec (&Spec, TS_DEFAULT_TYPE_INT, SC_AUTO); + ParseDeclSpec (&Spec, TS_DEFAULT_TYPE_NONE, SC_AUTO); if ((Spec.Flags & DS_TYPE_MASK) != DS_NONE) { Error ("Mixed declarations and code are not supported in cc65"); diff --git a/test/ref/bug1889-missing-identifier.c b/test/ref/bug1889-missing-identifier.c index d9cf4aa52..a8140565f 100644 --- a/test/ref/bug1889-missing-identifier.c +++ b/test/ref/bug1889-missing-identifier.c @@ -3,6 +3,8 @@ int enum { a } x; inline enum { b }; +_Static_assert(); + int main(void) { return 0; diff --git a/test/ref/bug1889-missing-identifier.cref b/test/ref/bug1889-missing-identifier.cref index 7381d2032..6317657d1 100644 --- a/test/ref/bug1889-missing-identifier.cref +++ b/test/ref/bug1889-missing-identifier.cref @@ -1,3 +1,4 @@ bug1889-missing-identifier.c:3: Error: Identifier or ';' expected after declaration specifiers bug1889-missing-identifier.c:3: Warning: Implicit 'int' is an obsolete feature bug1889-missing-identifier.c:4: Error: Declaration specifier or identifier expected +bug1889-missing-identifier.c:6: Error: Expression expected