Commit 51a203d9 by Mark Mitchell

re PR c++/29105 (segfault in add_candidates with a non template base class and a…

re PR c++/29105 (segfault in add_candidates with a non template base class and a template member function)

	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
parent 297d4105
...@@ -7779,15 +7779,15 @@ tsubst_baselink (tree baselink, tree object_type, ...@@ -7779,15 +7779,15 @@ tsubst_baselink (tree baselink, tree object_type,
tree template_args = 0; tree template_args = 0;
bool template_id_p = false; bool template_id_p = false;
/* A baselink indicates a function from a base class. The /* A baselink indicates a function from a base class. Both the
BASELINK_ACCESS_BINFO and BASELINK_BINFO are going to have BASELINK_ACCESS_BINFO and the base class referenced may
non-dependent types; otherwise, the lookup could not have indicate bases of the template class, rather than the
succeeded. However, they may indicate bases of the template instantiated class. In addition, lookups that were not
class, rather than the instantiated class. ambiguous before may be ambiguous now. Therefore, we perform
the lookup again. */
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 = BINFO_TYPE (BASELINK_ACCESS_BINFO (baselink));
qualifying_scope = tsubst (qualifying_scope, args,
complain, in_decl);
fns = BASELINK_FUNCTIONS (baselink); fns = BASELINK_FUNCTIONS (baselink);
optype = BASELINK_OPTYPE (baselink); optype = BASELINK_OPTYPE (baselink);
if (TREE_CODE (fns) == TEMPLATE_ID_EXPR) if (TREE_CODE (fns) == TEMPLATE_ID_EXPR)
......
...@@ -2400,7 +2400,6 @@ baselink_for_fns (tree fns) ...@@ -2400,7 +2400,6 @@ baselink_for_fns (tree fns)
tree cl; tree cl;
if (BASELINK_P (fns) if (BASELINK_P (fns)
|| processing_template_decl
|| error_operand_p (fns)) || error_operand_p (fns))
return fns; return fns;
......
...@@ -11,7 +11,7 @@ struct A ...@@ -11,7 +11,7 @@ struct A
template<typename T> void bar(T t) { template<typename T> void bar(T t) {
this->foo<typename T>(t); } // { dg-error "expected|parse error|no matching" } this->foo<typename T>(t); } // { dg-error "expected|parse error|no matching" }
template<typename T> void bad(T t) { 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> template <typename T>
......
// PR c++/29105
struct Observer
{
template < typename T > void observeComponent ();
};
template < typename T >
struct TagFilter : Observer
{
TagFilter ()
{
observeComponent < int > ();
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment