From 4864cc4ab3165bab1931eab121f7d81c39c8fcd8 Mon Sep 17 00:00:00 2001 From: Kriang Lerdsuwanakij Date: Sun, 23 Nov 2003 11:32:14 +0000 Subject: [PATCH] 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 --- gcc/cp/ChangeLog | 6 +++++ gcc/cp/typeck.c | 5 +++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/template/template-id-2.C | 22 +++++++++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/template-id-2.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1ec5f1f3b0b..a6d4223a3e1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2003-11-23 Kriang Lerdsuwanakij + + 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 * pt.c (tsubst) : Remove erroneous argument to build_nt. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index fa325c0b952..f2cca5feabf 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c339a0da467..592508be664 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-11-23 Kriang Lerdsuwanakij + + PR c++/12924 + * g++.dg/template/template-id-2.C: New test. + 2003-11-22 Kriang Lerdsuwanakij PR c++/5369 diff --git a/gcc/testsuite/g++.dg/template/template-id-2.C b/gcc/testsuite/g++.dg/template/template-id-2.C new file mode 100644 index 00000000000..1bc378c14e6 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/template-id-2.C @@ -0,0 +1,22 @@ +// { dg-do compile } + +// Origin: Richard Guenther + +// PR c++/12924 + +template struct A {}; + +template<> struct A +{ + template void foo() + { + A a; + a.template foo(); // { dg-error "no member" } + } +}; + +void bar() +{ + A a; + a.foo(); // { dg-error "instantiated" } +}