summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/parser.c6
2 files changed, 7 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9a2f01ddc4e..59b0e40b000 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2010-04-06 Jason Merrill <jason@redhat.com>
+ PR c++/43648
+ * name-lookup.c (constructor_name_p): Allow X::~X even for typedefs.
+
PR c++/43621
* pt.c (maybe_update_decl_type): Check the return value from
push_scope.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 6b119b6907e..8a1bb9f600e 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -3897,13 +3897,15 @@ cp_parser_unqualified_id (cp_parser* parser,
}
gcc_assert (!scope || TYPE_P (scope));
- /* If the name is of the form "X::~X" it's OK. */
+ /* If the name is of the form "X::~X" it's OK even if X is a
+ typedef. */
token = cp_lexer_peek_token (parser->lexer);
if (scope
&& token->type == CPP_NAME
&& (cp_lexer_peek_nth_token (parser->lexer, 2)->type
!= CPP_LESS)
- && constructor_name_p (token->u.value, scope))
+ && (token->u.value == TYPE_IDENTIFIER (scope)
+ || constructor_name_p (token->u.value, scope)))
{
cp_lexer_consume_token (parser->lexer);
return build_nt (BIT_NOT_EXPR, scope);