Do not diagnose lambda default arguments in c++14 modes.

* parser.c (cp_parser_lambda_declarator_opt): Make the pedwarn
	conditional.

From-SVN: r215274
This commit is contained in:
Ville Voutilainen 2014-09-15 22:31:35 +03:00 committed by Jason Merrill
parent 717c478953
commit 6a3d8ef0b8
3 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2014-09-15 Ville Voutilainen <ville.voutilainen@gmail.com>
Do not diagnose lambda default arguments in c++14 modes.
* parser.c (cp_parser_lambda_declarator_opt): Make the pedwarn
conditional.
2014-09-15 Jakub Jelinek <jakub@redhat.com>
* Make-lang.in (check_g++_parallelize): Change to just an upper bound

View File

@ -9222,7 +9222,7 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr)
/* Default arguments shall not be specified in the
parameter-declaration-clause of a lambda-declarator. */
for (tree t = param_list; t; t = TREE_CHAIN (t))
if (TREE_PURPOSE (t))
if (TREE_PURPOSE (t) && cxx_dialect < cxx14)
pedwarn (DECL_SOURCE_LOCATION (TREE_VALUE (t)), OPT_Wpedantic,
"default argument specified for lambda parameter");

View File

@ -2,5 +2,5 @@
int main()
{
[](int a = 1) { return a; }(); // { dg-error "" }
[](int a = 1) { return a; }(); // { dg-error "default argument" "" { target { c++11_only } } }
}