diff options
author | Mark Mitchell <mark@codesourcery.com> | 2004-01-29 01:29:03 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2004-01-29 01:29:03 +0000 |
commit | a7324e75d17b3baa22fbe33fc0a502681ad40f56 (patch) | |
tree | a749774481323c60ee4d85c6ebcc2a24aceffaf9 /gcc/cp/parser.c | |
parent | d173e68599639b825a1e12884fa35c00a024bee4 (diff) | |
download | gcc-a7324e75d17b3baa22fbe33fc0a502681ad40f56.zip gcc-a7324e75d17b3baa22fbe33fc0a502681ad40f56.tar.gz gcc-a7324e75d17b3baa22fbe33fc0a502681ad40f56.tar.bz2 |
re PR c++/13736 (Parser confused on compound casts)
PR c++/13736
* parser.c (cp_parser_direct_declarator): Do not prevent
backtracking inside a parenthesized declarator.
(cp_parser_parameter_declaration): Fix typo in comment.
PR c++/13736
* g++.dg/parse/cast2.C (main): New test.
From-SVN: r76825
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r-- | gcc/cp/parser.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 0ca1dca..7c9be85 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -10285,15 +10285,20 @@ cp_parser_direct_declarator (cp_parser* parser, declarator. */ if (first) { + bool saved_in_type_id_in_expr_p; + parser->default_arg_ok_p = saved_default_arg_ok_p; parser->in_declarator_p = saved_in_declarator_p; /* Consume the `('. */ cp_lexer_consume_token (parser->lexer); /* Parse the nested declarator. */ + saved_in_type_id_in_expr_p = parser->in_type_id_in_expr_p; + parser->in_type_id_in_expr_p = true; declarator = cp_parser_declarator (parser, dcl_kind, ctor_dtor_or_conv_p, /*parenthesized_p=*/NULL); + parser->in_type_id_in_expr_p = saved_in_type_id_in_expr_p; first = false; /* Expect a `)'. */ if (!cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'")) @@ -11048,11 +11053,11 @@ cp_parser_parameter_declaration (cp_parser *parser, if (!parser->in_template_argument_list_p /* In an expression context, having seen: - (int((char *)... + (int((char ... we cannot be sure whether we are looking at a - function-type (taking a "char*" as a parameter) or a cast - of some object of type "char*" to "int". */ + function-type (taking a "char" as a parameter) or a cast + of some object of type "char" to "int". */ && !parser->in_type_id_in_expr_p && cp_parser_parsing_tentatively (parser) && !cp_parser_committed_to_tentative_parse (parser) |