commit 365eff32e0004b7e3ac0794a2fbb5d6585f4b4d7
Author: Jason Merrill <jason@redhat.com>
Date: Wed May 25 11:44:48 2011 -0400
PR c++/47184
* parser.c (cp_parser_parameter_declaration): Recognize
list-initialization.
@@ -14901,6 +14901,9 @@ cp_parser_direct_declarator (cp_parser* parser,
parser->num_template_parameter_lists
= saved_num_template_parameter_lists;
+ /* Consume the `)'. */
+ cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN);
+
/* If all went well, parse the cv-qualifier-seq and the
exception-specification. */
if (member_p || cp_parser_parse_definitely (parser))
@@ -14915,8 +14918,6 @@ cp_parser_direct_declarator (cp_parser* parser,
if (ctor_dtor_or_conv_p)
*ctor_dtor_or_conv_p = *ctor_dtor_or_conv_p < 0;
first = false;
- /* Consume the `)'. */
- cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN);
/* Parse the cv-qualifier-seq. */
cv_quals = cp_parser_cv_qualifier_seq_opt (parser);
@@ -16053,6 +16054,7 @@ cp_parser_parameter_declaration (cp_parser *parser,
of some object of type "char" to "int". */
&& !parser->in_type_id_in_expr_p
&& cp_parser_uncommitted_to_tentative_parse_p (parser)
+ && cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE)
&& cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_PAREN))
cp_parser_commit_to_tentative_parse (parser);
/* Parse the declarator. */
new file mode 100644
@@ -0,0 +1,15 @@
+// PR c++/47184
+// { dg-options -std=c++0x }
+
+struct S
+{
+ int a;
+};
+struct T
+{
+ T(S s) {}
+};
+int main()
+{
+ T t(S{1});
+}