aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-07-10 10:24:03 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-07-10 10:24:03 -0400
commit53130f756045ccc520dc6ec8a6881dedfad8b46a (patch)
tree791dd149ab8ea0df82b255c78fc444837e3d1ae9 /gcc/cp
parent7746ff43a6f8e6e555464367c08e0a1f43eedc57 (diff)
downloadgcc-53130f756045ccc520dc6ec8a6881dedfad8b46a.zip
gcc-53130f756045ccc520dc6ec8a6881dedfad8b46a.tar.gz
gcc-53130f756045ccc520dc6ec8a6881dedfad8b46a.tar.bz2
re PR c++/49691 (ICE in cp_parser_late_return_type_opt, at cp/parser.c:15562)
PR c++/49691 * parser.c (cp_parser_late_return_type_opt): Check quals parameter rather than current_class_type to determine whether to set 'this'. (cp_parser_direct_declarator): Pass -1 to quals if member_p is false. (cp_parser_init_declarator): Pass down member_p. From-SVN: r176120
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/parser.c13
2 files changed, 16 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c19e8b3..765c33b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,11 @@
+2011-07-10 Jason Merrill <jason@redhat.com>
+
+ PR c++/49691
+ * parser.c (cp_parser_late_return_type_opt): Check quals parameter
+ rather than current_class_type to determine whether to set 'this'.
+ (cp_parser_direct_declarator): Pass -1 to quals if member_p is false.
+ (cp_parser_init_declarator): Pass down member_p.
+
2011-07-09 Jason Merrill <jason@redhat.com>
* tree.c (build_vec_init_elt): Strip TARGET_EXPR.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 6bb15ed..64be923 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -14388,7 +14388,7 @@ cp_parser_init_declarator (cp_parser* parser,
= cp_parser_declarator (parser, CP_PARSER_DECLARATOR_NAMED,
&ctor_dtor_or_conv_p,
/*parenthesized_p=*/NULL,
- /*member_p=*/false);
+ member_p);
/* Gather up the deferred checks. */
stop_deferring_access_checks ();
@@ -14971,8 +14971,8 @@ cp_parser_direct_declarator (cp_parser* parser,
/* Parse the virt-specifier-seq. */
virt_specifiers = cp_parser_virt_specifier_seq_opt (parser);
- late_return
- = cp_parser_late_return_type_opt (parser, cv_quals);
+ late_return = (cp_parser_late_return_type_opt
+ (parser, member_p ? cv_quals : -1));
/* Create the function-declarator. */
declarator = make_call_declarator (declarator,
@@ -15538,7 +15538,10 @@ cp_parser_virt_specifier_seq_opt (cp_parser* parser)
-> trailing-type-specifier-seq abstract-declarator(opt)
- Returns the type indicated by the type-id. */
+ Returns the type indicated by the type-id.
+
+ QUALS is either a bitmask of cv_qualifiers or -1 for a non-member
+ function. */
static tree
cp_parser_late_return_type_opt (cp_parser* parser, cp_cv_quals quals)
@@ -15555,7 +15558,7 @@ cp_parser_late_return_type_opt (cp_parser* parser, cp_cv_quals quals)
/* Consume the ->. */
cp_lexer_consume_token (parser->lexer);
- if (current_class_type)
+ if (quals >= 0)
{
/* DR 1207: 'this' is in scope in the trailing return type. */
tree this_parm = build_this_parm (current_class_type, quals);