forked from OSchip/llvm-project
Top-level semicolons are allowed in C++0x. Fixes PR4755.
llvm-svn: 79912
This commit is contained in:
parent
c8c277a1b3
commit
8b9575f27e
|
@ -375,7 +375,7 @@ void Parser::ParseTranslationUnit() {
|
|||
/// external-declaration: [C99 6.9], declaration: [C++ dcl.dcl]
|
||||
/// function-definition
|
||||
/// declaration
|
||||
/// [EXT] ';'
|
||||
/// [C++0x] empty-declaration
|
||||
/// [GNU] asm-definition
|
||||
/// [GNU] __extension__ external-declaration
|
||||
/// [OBJC] objc-class-definition
|
||||
|
@ -388,12 +388,17 @@ void Parser::ParseTranslationUnit() {
|
|||
/// [GNU] asm-definition:
|
||||
/// simple-asm-expr ';'
|
||||
///
|
||||
/// [C++0x] empty-declaration:
|
||||
/// ';'
|
||||
///
|
||||
Parser::DeclGroupPtrTy Parser::ParseExternalDeclaration() {
|
||||
DeclPtrTy SingleDecl;
|
||||
switch (Tok.getKind()) {
|
||||
case tok::semi:
|
||||
Diag(Tok, diag::ext_top_level_semi)
|
||||
<< CodeModificationHint::CreateRemoval(SourceRange(Tok.getLocation()));
|
||||
if (!getLang().CPlusPlus0x)
|
||||
Diag(Tok, diag::ext_top_level_semi)
|
||||
<< CodeModificationHint::CreateRemoval(SourceRange(Tok.getLocation()));
|
||||
|
||||
ConsumeToken();
|
||||
// TODO: Invoke action for top-level semicolon.
|
||||
return DeclGroupPtrTy();
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
// RUN: clang-cc -fsyntax-only -pedantic -std=c++0x -verify %s
|
||||
|
||||
void foo();
|
||||
|
||||
void bar() { };
|
||||
|
||||
void wibble();
|
||||
|
||||
;
|
|
@ -122,4 +122,3 @@ struct Q {
|
|||
|
||||
float *pf;
|
||||
};
|
||||
|
||||
|
|
|
@ -83,3 +83,4 @@ void A::S::f2() {}
|
|||
A::S::operator int() { return 1; }
|
||||
|
||||
A::S::~S() {}
|
||||
|
||||
|
|
Loading…
Reference in New Issue