re PR c++/12924 (ICE in lookup_member, at cp/search.c:1228)

PR c++/12924
	* typeck.c (finish_class_member_access_expr): Handle TEMPLATE_ID_EXPR
	with OVERLOAD and DECL nodes as the first operand.

	* g++.dg/template/template-id-2.C: New test.

From-SVN: r73851
This commit is contained in:
Kriang Lerdsuwanakij 2003-11-23 11:32:14 +00:00 committed by Kriang Lerdsuwanakij
parent 539edbe025
commit 4864cc4ab3
4 changed files with 38 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2003-11-23 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/12924
* typeck.c (finish_class_member_access_expr): Handle TEMPLATE_ID_EXPR
with OVERLOAD and DECL nodes as the first operand.
2003-11-22 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
* pt.c (tsubst) <ARRAY_REF>: Remove erroneous argument to build_nt.

View File

@ -1860,6 +1860,11 @@ finish_class_member_access_expr (tree object, tree name)
is_template_id = true;
template_args = TREE_OPERAND (name, 1);
name = TREE_OPERAND (name, 0);
if (TREE_CODE (name) == OVERLOAD)
name = DECL_NAME (get_first_fn (name));
else if (DECL_P (name))
name = DECL_NAME (name);
}
if (TREE_CODE (name) == SCOPE_REF)

View File

@ -1,3 +1,8 @@
2003-11-23 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/12924
* g++.dg/template/template-id-2.C: New test.
2003-11-22 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/5369

View File

@ -0,0 +1,22 @@
// { dg-do compile }
// Origin: Richard Guenther <rguenth@tat.physik.uni-tuebingen.de>
// PR c++/12924
template<typename> struct A {};
template<> struct A<void>
{
template<typename T> void foo()
{
A<T> a;
a.template foo<int>(); // { dg-error "no member" }
}
};
void bar()
{
A<void> a;
a.foo<int>(); // { dg-error "instantiated" }
}