From 056e3a4e901110c16092568f03cad588bd05af8c Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Wed, 2 Jan 2008 19:17:38 +0000 Subject: [PATCH] Issue diagnostic when objective-c's @interface is preceeded by a type specifier. llvm-svn: 45491 --- clang/Parse/Parser.cpp | 3 +++ clang/test/Parser/check-syntax-1.m | 4 ++++ 2 files changed, 7 insertions(+) create mode 100644 clang/test/Parser/check-syntax-1.m diff --git a/clang/Parse/Parser.cpp b/clang/Parse/Parser.cpp index c5a21c72b614..04cfea6f07a0 100644 --- a/clang/Parse/Parser.cpp +++ b/clang/Parse/Parser.cpp @@ -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/clang/test/Parser/check-syntax-1.m b/clang/test/Parser/check-syntax-1.m new file mode 100644 index 000000000000..9036c65dce55 --- /dev/null +++ b/clang/test/Parser/check-syntax-1.m @@ -0,0 +1,4 @@ +// RUN: clang -fsyntax-only -verify %s + +int @interface bla ; // expected-error {{cannot combine with previous 'int' declaration specifier}} +@end