forked from OSchip/llvm-project
Add the missing compatibility warning for braced initializers as default arguments.
llvm-svn: 153026
This commit is contained in:
parent
44057c3d01
commit
1678d5f7b2
|
@ -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);
|
||||
|
|
|
@ -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}} \
|
||||
|
|
Loading…
Reference in New Issue