diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4945fd9c912..92025a98e6b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2011-11-07 Jason Merrill + 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 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index fa0117ec3e4..697be809adb 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e2eccc55680..c5f4118d2ad 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2011-11-07 Jason Merrill + PR c++/50863 + * g++.dg/cpp0x/lambda/lambda-initlist1.C: New. + PR c++/50870 * g++.dg/cpp0x/decltype35.C: New. diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-initlist1.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-initlist1.C new file mode 100644 index 00000000000..078ebaee183 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-initlist1.C @@ -0,0 +1,12 @@ +// PR c++/50863 +// { dg-options -std=gnu++0x } + +struct T { + template + T(F) { } +}; + +int main() +{ + T t{ []{ } }; +}