Comments
Patch
commit fc9080728a450c22b6f70c133e9d12835733195f
Author: Jason Merrill <jason@redhat.com>
Date: Mon Nov 7 17:23:46 2011 -0500
PR c++/50863
* parser.c (cp_parser_initializer_list): Parse C99
array designators tentatively.
@@ -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;
new file mode 100644
@@ -0,0 +1,12 @@
+// PR c++/50863
+// { dg-options -std=gnu++0x }
+
+struct T {
+ template<typename F>
+ T(F) { }
+};
+
+int main()
+{
+ T t{ []{ } };
+}