re PR c++/43648 (ICE with explicit destructor call and typedef)

PR c++/43648
	* name-lookup.c (constructor_name_p): Allow X::~X even for typedefs.

From-SVN: r158007
This commit is contained in:
Jason Merrill 2010-04-06 12:12:15 -04:00 committed by Jason Merrill
parent d5eebac0bb
commit 62daa13984
4 changed files with 33 additions and 2 deletions

View file

@ -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.

View file

@ -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);

View file

@ -1,5 +1,8 @@
2010-04-06 Jason Merrill <jason@redhat.com>
PR c++/43648
* g++.dg/template/dtor8.C: New.
PR c++/43621
* g++.dg/template/error-recovery2.C: New.

View file

@ -0,0 +1,23 @@
// PR c++/43648
namespace dealii
{
namespace FEValuesViews
{
template <int dim, int spacedim> struct Scalar {};
}
template <int dim, int spacedim>
struct X
{
FEValuesViews::Scalar<dim,spacedim> scalars[dim*spacedim];
void f()
{
typedef dealii::FEValuesViews::Scalar<dim,spacedim> ScalarView;
scalars[0].ScalarView::~ScalarView ();
}
};
template struct X<2,2>;
}