summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/declspec.c
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-02 01:23:29 +0000
committerChris Lattner <sabre@nondot.org>2010-02-02 01:23:29 +0000
commitcf25141d1442c04f36fc8e8342763cd043218b7b (patch)
treea26fd93990ad3993a18124fe066d50e560257d7c /clang/test/Sema/declspec.c
parent13ad81bd70afaf35d54a080893dc6beb7e1c1b0c (diff)
downloadbcm5719-llvm-cf25141d1442c04f36fc8e8342763cd043218b7b.tar.gz
bcm5719-llvm-cf25141d1442c04f36fc8e8342763cd043218b7b.zip
Implement PR6180, substantially improving the diagnostics we get from
forgetting a ';' at the end of a struct. For something like: class c { } void foo() {} we now produce: t.cc:3:2: error: expected ';' after class } ^ ; instead of: t.cc:4:1: error: cannot combine with previous 'class' declaration specifier void foo() {} ^ t.cc:2:7: error: 'class c' can not be defined in the result type of a function class c { ^ GCC produces: t.cc:4: error: new types may not be defined in a return type t.cc:4: note: (perhaps a semicolon is missing after the definition of ‘c’) t.cc:4: error: two or more data types in declaration of ‘foo’ I *think* I got the follow set right, but if I forgot anything, we'll start getting spurious "expected ';' after class" errors, let me know if you see any. llvm-svn: 95042
Diffstat (limited to 'clang/test/Sema/declspec.c')
-rw-r--r--clang/test/Sema/declspec.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/clang/test/Sema/declspec.c b/clang/test/Sema/declspec.c
index 5b119601603..e1f2bf4911a 100644
--- a/clang/test/Sema/declspec.c
+++ b/clang/test/Sema/declspec.c
@@ -7,11 +7,10 @@ void foof(const char *, ...) __attribute__((__format__(__printf__, 1, 2))), barf
int typedef validTypeDecl() { } // expected-error {{function definition declared 'typedef'}}
-struct _zend_module_entry { }
-typedef struct _zend_function_entry { } // expected-error {{cannot combine with previous 'struct' declaration specifier}}
-static void buggy(int *x) { } // expected-error {{function definition declared 'typedef'}} \
- // expected-error {{cannot combine with previous 'typedef' declaration specifier}} \
- // expected-error {{cannot combine with previous 'struct' declaration specifier}}
+struct _zend_module_entry { } // expected-error {{expected ';' after struct}}
+typedef struct _zend_function_entry { } // expected-error {{expected ';' after struct}} \
+ // expected-error {{declaration does not declare anything}}
+static void buggy(int *x) { }
// Type qualifiers.
typedef int f(void);
@@ -22,3 +21,10 @@ __restrict__ fptr v3; // expected-error {{pointer to function type 'f' (aka 'int
f *__restrict__ v4; // expected-error {{pointer to function type 'f' (aka 'int (void)') may not be 'restrict' qualified}}
restrict struct hallo; // expected-error {{restrict requires a pointer or reference}}
+
+// PR6180
+struct test1 {
+} // expected-error {{expected ';' after struct}}
+
+void test2() {}
+
OpenPOWER on IntegriCloud