From: Andy Gibbs Date: Wed, 3 Apr 2013 09:31:19 +0000 (+0000) Subject: Assert that Parser::ParseStructUnionBody is not called for C++ code. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f50f3f7cee281f4e59854b0f56a78abe02fcd25d;p=clang Assert that Parser::ParseStructUnionBody is not called for C++ code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178631 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 87b8a2d906..589723a1d1 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -3066,6 +3066,7 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc, unsigned TagType, Decl *TagDecl) { PrettyDeclStackTraceEntry CrashInfo(Actions, TagDecl, RecordLoc, "parsing struct/union body"); + assert(!getLangOpts().CPlusPlus && "C++ declarations not supported"); BalancedDelimiterTracker T(*this, tok::l_brace); if (T.consumeOpen()) @@ -3074,9 +3075,8 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc, ParseScope StructScope(this, Scope::ClassScope|Scope::DeclScope); Actions.ActOnTagStartDefinition(getCurScope(), TagDecl); - // Empty structs are an extension in C (C99 6.7.2.1p7), but are allowed in - // C++. - if (Tok.is(tok::r_brace) && !getLangOpts().CPlusPlus) { + // Empty structs are an extension in C (C99 6.7.2.1p7). + if (Tok.is(tok::r_brace)) { Diag(Tok, diag::ext_empty_struct_union) << (TagType == TST_union); Diag(Tok, diag::warn_empty_struct_union_compat) << (TagType == TST_union); }