Add the missing compatibility warning for braced initializers as default arguments.

llvm-svn: 153026
This commit is contained in:
Sebastian Redl 2012-03-18 22:25:45 +00:00
parent 44057c3d01
commit 1678d5f7b2
2 changed files with 5 additions and 3 deletions

View File

@ -4282,9 +4282,10 @@ void Parser::ParseParameterDeclarationClause(
Param);
ExprResult DefArgResult;
if (Tok.is(tok::l_brace))
if (getLangOpts().CPlusPlus0x && Tok.is(tok::l_brace)) {
Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
DefArgResult = ParseBraceInitializer();
else
} else
DefArgResult = ParseAssignmentExpression();
if (DefArgResult.isInvalid()) {
Actions.ActOnParamDefaultArgumentError(Param);

View File

@ -39,7 +39,8 @@ void Lambda() {
[]{}(); // expected-warning {{lambda expressions are incompatible with C++98}}
}
int InitList() {
int InitList(int i = {}) { // expected-warning {{generalized initializer lists are incompatible with C++98}} \
// expected-warning {{scalar initialized from empty initializer list is incompatible with C++98}}
(void)new int {}; // expected-warning {{generalized initializer lists are incompatible with C++98}} \
// expected-warning {{scalar initialized from empty initializer list is incompatible with C++98}}
(void)int{}; // expected-warning {{generalized initializer lists are incompatible with C++98}} \