]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/29105 (segfault in add_candidates with a non template base class and a...
authorMark Mitchell <mmitchel@gcc.gnu.org>
Mon, 2 Oct 2006 04:12:51 +0000 (04:12 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Mon, 2 Oct 2006 04:12:51 +0000 (04:12 +0000)
PR c++/29105
* pt.c (tsubst_baselink): Substituteinto the qualifying scope.
* semantics.c (baselink_for_fns): Build a baselink, even when
processing a template.
PR c++/29105
* g++.dg/template/member6.C: New test.
* g++.dg/parse/typename7.C: Adjust error markers.

From-SVN: r117361

gcc/cp/pt.c
gcc/cp/semantics.c
gcc/testsuite/g++.dg/parse/typename7.C
gcc/testsuite/g++.dg/template/member6.C [new file with mode: 0644]

index 4e8fad66e5c352090cca48bd513daccd2df719e1..3106023d89a678c4cf0b5eb81f8e086656e928af 100644 (file)
@@ -7779,15 +7779,15 @@ tsubst_baselink (tree baselink, tree object_type,
     tree template_args = 0;
     bool template_id_p = false;
 
-    /* A baselink indicates a function from a base class.  The
-       BASELINK_ACCESS_BINFO and BASELINK_BINFO are going to have
-       non-dependent types; otherwise, the lookup could not have
-       succeeded.  However, they may indicate bases of the template
-       class, rather than the instantiated class.
-
-       In addition, lookups that were not ambiguous before may be
-       ambiguous now.  Therefore, we perform the lookup again.  */
+    /* A baselink indicates a function from a base class.  Both the
+       BASELINK_ACCESS_BINFO and the base class referenced may
+       indicate bases of the template class, rather than the
+       instantiated class.  In addition, lookups that were not
+       ambiguous before may be ambiguous now.  Therefore, we perform
+       the lookup again.  */
     qualifying_scope = BINFO_TYPE (BASELINK_ACCESS_BINFO (baselink));
+    qualifying_scope = tsubst (qualifying_scope, args,
+                              complain, in_decl);
     fns = BASELINK_FUNCTIONS (baselink);
     optype = BASELINK_OPTYPE (baselink);
     if (TREE_CODE (fns) == TEMPLATE_ID_EXPR)
index 3c7281880d4ec10752d6b862a02e89b0562022fc..91d200a588e8179432c68f6ccaa049173ac20edd 100644 (file)
@@ -2400,7 +2400,6 @@ baselink_for_fns (tree fns)
   tree cl;
 
   if (BASELINK_P (fns) 
-      || processing_template_decl
       || error_operand_p (fns))
     return fns;
   
index 56fcc7436a4a20a4cacc093a55c83f4789b7adbf..3cee4bac68bf7fbbe1b10b2e7bffa7ae9b7ce2a2 100644 (file)
@@ -11,7 +11,7 @@ struct A
   template<typename T> void bar(T t) {
     this->foo<typename T>(t); } // { dg-error "expected|parse error|no matching" }
   template<typename T> void bad(T t) {
-    foo<typename T>(t); } // { dg-error "expected|parse error" }
+    foo<typename T>(t); } // { dg-error "expected|parse error|no matching" }
 };
 
 template <typename T>
diff --git a/gcc/testsuite/g++.dg/template/member6.C b/gcc/testsuite/g++.dg/template/member6.C
new file mode 100644 (file)
index 0000000..7d66e7b
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/29105
+
+struct Observer
+{
+  template < typename T > void observeComponent ();
+};
+
+template < typename T >
+struct TagFilter : Observer
+{
+  TagFilter ()
+  {
+    observeComponent < int > ();
+  }
+};
+