]> granicus.if.org Git - clang/commitdiff
Issue diagnostic when objective-c's @interface is preceeded by a type specifier.
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 2 Jan 2008 19:17:38 +0000 (19:17 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 2 Jan 2008 19:17:38 +0000 (19:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45491 91177308-0d34-0410-b5e6-96231b3b80d8

Parse/Parser.cpp
test/Parser/check-syntax-1.m [new file with mode: 0644]

index c5a21c72b61472482288765c1e286eeb04d21f45..04cfea6f07a0f1196e80ed56f7dd86b72f017628 100644 (file)
@@ -379,6 +379,9 @@ Parser::DeclTy *Parser::ParseDeclarationOrFunctionDefinition() {
       SkipUntil(tok::semi); // FIXME: better skip?
       return 0;
     }
+    const char *PrevSpec = 0;
+    if (DS.SetTypeSpecType(DeclSpec::TST_unspecified, AtLoc, PrevSpec))
+      Diag(AtLoc, diag::err_invalid_decl_spec_combination, PrevSpec);
     return ParseObjCAtInterfaceDeclaration(AtLoc, DS.getAttributes()); 
   }
   
diff --git a/test/Parser/check-syntax-1.m b/test/Parser/check-syntax-1.m
new file mode 100644 (file)
index 0000000..9036c65
--- /dev/null
@@ -0,0 +1,4 @@
+// RUN: clang -fsyntax-only -verify %s
+
+int @interface bla  ; // expected-error {{cannot combine with previous 'int' declaration specifier}}
+@end