Skip to content

Commit

Permalink
[Parse][Reflection] Parse constexpr declarations in C++1z mode only
Browse files Browse the repository at this point in the history
This resolves #15.
  • Loading branch information
Jenny-fa committed Apr 21, 2017
1 parent 2275d88 commit 0a1eb43
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/Parse/ParseDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,7 @@ Parser::DeclGroupPtrTy Parser::ParseDeclaration(unsigned Context,
break;

case tok::kw_constexpr: // [Meta]: constexpr-declaration
if (NextToken().is(tok::l_brace))
if (getLangOpts().CPlusPlus1z && NextToken().is(tok::l_brace))
return ParseConstexprDeclaration();

default:
Expand Down
3 changes: 2 additions & 1 deletion lib/Parse/ParseDeclCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2518,7 +2518,8 @@ Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
}

// constexpr-declaration
if (Tok.is(tok::kw_constexpr) && NextToken().is(tok::l_brace))
if (getLangOpts().CPlusPlus1z && Tok.is(tok::kw_constexpr) &&
NextToken().is(tok::l_brace))
return ParseConstexprDeclaration();

// Hold late-parsed attributes so we can attach a Decl to them later.
Expand Down
2 changes: 1 addition & 1 deletion lib/Parse/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ Parser::ParseExternalDeclaration(ParsedAttributesWithRange &attrs,
goto dont_know;

case tok::kw_constexpr: // [Meta] constexpr-declaration
if (NextToken().is(tok::l_brace))
if (getLangOpts().CPlusPlus1z && NextToken().is(tok::l_brace))
return ParseConstexprDeclaration();
goto dont_know;

Expand Down

0 comments on commit 0a1eb43

Please sign in to comment.