re PR c++/50863 ([C++0x] list-initialization with lambda fails to deduce constructor argument)

PR c++/50863
	* parser.c (cp_parser_initializer_list): Parse C99
	array designators tentatively.

From-SVN: r181132
This commit is contained in:
Jason Merrill 2011-11-07 17:52:32 -05:00 committed by Jason Merrill
parent b2b5f337dc
commit 13fc31c2c4
4 changed files with 22 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2011-11-07 Jason Merrill <jason@redhat.com>
PR c++/50863
* parser.c (cp_parser_initializer_list): Parse C99
array designators tentatively.
PR c++/50870
* pt.c (tsubst_copy): Handle NAMESPACE_DECL.
(tsubst_copy_and_build) [COMPONENT_REF]: Handle a still-dependent

View File

@ -17580,10 +17580,13 @@ cp_parser_initializer_list (cp_parser* parser, bool* non_constant_p)
&& !c_dialect_objc ()
&& cp_lexer_next_token_is (parser->lexer, CPP_OPEN_SQUARE))
{
/* In C++11, [ could start a lambda-introducer. */
cp_parser_parse_tentatively (parser);
cp_lexer_consume_token (parser->lexer);
designator = cp_parser_constant_expression (parser, false, NULL);
cp_parser_require (parser, CPP_CLOSE_SQUARE, RT_CLOSE_SQUARE);
cp_parser_require (parser, CPP_EQ, RT_EQ);
cp_parser_parse_definitely (parser);
}
else
designator = NULL_TREE;

View File

@ -1,5 +1,8 @@
2011-11-07 Jason Merrill <jason@redhat.com>
PR c++/50863
* g++.dg/cpp0x/lambda/lambda-initlist1.C: New.
PR c++/50870
* g++.dg/cpp0x/decltype35.C: New.

View File

@ -0,0 +1,12 @@
// PR c++/50863
// { dg-options -std=gnu++0x }
struct T {
template<typename F>
T(F) { }
};
int main()
{
T t{ []{ } };
}