OSDN Git Service

PR c++/43648
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Apr 2010 16:12:15 +0000 (16:12 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Apr 2010 16:12:15 +0000 (16:12 +0000)
* name-lookup.c (constructor_name_p): Allow X::~X even for typedefs.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158007 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/dtor8.C [new file with mode: 0644]

index 9a2f01d..59b0e40 100644 (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.
index 6b119b6..8a1bb9f 100644 (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);
index d1acb39..66018c5 100644 (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.
 
diff --git a/gcc/testsuite/g++.dg/template/dtor8.C b/gcc/testsuite/g++.dg/template/dtor8.C
new file mode 100644 (file)
index 0000000..a96b798
--- /dev/null
@@ -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>;
+}