re PR c++/47184 ([C++0x] initialization construct interpreted as function declaration)
PR c++/47184 * parser.c (cp_parser_parameter_declaration): Recognize list-initialization. (cp_parser_direct_declarator): Check for the closing paren before parsing definitely. From-SVN: r174225
This commit is contained in:
parent
c497c412b4
commit
636e368d17
@ -1,5 +1,11 @@
|
|||||||
2011-05-25 Jason Merrill <jason@redhat.com>
|
2011-05-25 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
PR c++/47184
|
||||||
|
* parser.c (cp_parser_parameter_declaration): Recognize
|
||||||
|
list-initialization.
|
||||||
|
(cp_parser_direct_declarator): Check for the closing
|
||||||
|
paren before parsing definitely.
|
||||||
|
|
||||||
PR c++/48935
|
PR c++/48935
|
||||||
* parser.c (cp_parser_constructor_declarator_p): Don't check
|
* parser.c (cp_parser_constructor_declarator_p): Don't check
|
||||||
constructor_name_p for enums.
|
constructor_name_p for enums.
|
||||||
|
@ -14901,6 +14901,9 @@ cp_parser_direct_declarator (cp_parser* parser,
|
|||||||
parser->num_template_parameter_lists
|
parser->num_template_parameter_lists
|
||||||
= saved_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
|
/* If all went well, parse the cv-qualifier-seq and the
|
||||||
exception-specification. */
|
exception-specification. */
|
||||||
if (member_p || cp_parser_parse_definitely (parser))
|
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)
|
if (ctor_dtor_or_conv_p)
|
||||||
*ctor_dtor_or_conv_p = *ctor_dtor_or_conv_p < 0;
|
*ctor_dtor_or_conv_p = *ctor_dtor_or_conv_p < 0;
|
||||||
first = false;
|
first = false;
|
||||||
/* Consume the `)'. */
|
|
||||||
cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN);
|
|
||||||
|
|
||||||
/* Parse the cv-qualifier-seq. */
|
/* Parse the cv-qualifier-seq. */
|
||||||
cv_quals = cp_parser_cv_qualifier_seq_opt (parser);
|
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". */
|
of some object of type "char" to "int". */
|
||||||
&& !parser->in_type_id_in_expr_p
|
&& !parser->in_type_id_in_expr_p
|
||||||
&& cp_parser_uncommitted_to_tentative_parse_p (parser)
|
&& 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_lexer_next_token_is_not (parser->lexer, CPP_OPEN_PAREN))
|
||||||
cp_parser_commit_to_tentative_parse (parser);
|
cp_parser_commit_to_tentative_parse (parser);
|
||||||
/* Parse the declarator. */
|
/* Parse the declarator. */
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2011-05-25 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
* g++.dg/cpp0x/initlist51.C: New.
|
||||||
|
|
||||||
2011-05-25 Janis Johnson <janisjo@codesourcery.com>
|
2011-05-25 Janis Johnson <janisjo@codesourcery.com>
|
||||||
|
|
||||||
* gcc.target/arm/fp16-compile-none-1.c: Update expected error.
|
* gcc.target/arm/fp16-compile-none-1.c: Update expected error.
|
||||||
|
15
gcc/testsuite/g++.dg/cpp0x/initlist51.C
Normal file
15
gcc/testsuite/g++.dg/cpp0x/initlist51.C
Normal file
@ -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});
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user