diff options
author | Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> | 2003-11-23 11:32:14 +0000 |
---|---|---|
committer | Kriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org> | 2003-11-23 11:32:14 +0000 |
commit | 4864cc4ab3165bab1931eab121f7d81c39c8fcd8 (patch) | |
tree | 5ee99609bf3ba17032239b93eee153faa8e9ced5 /gcc | |
parent | 539edbe025fc62fd752336b6bfe8b6a05a3afe0e (diff) | |
download | gcc-4864cc4ab3165bab1931eab121f7d81c39c8fcd8.zip gcc-4864cc4ab3165bab1931eab121f7d81c39c8fcd8.tar.gz gcc-4864cc4ab3165bab1931eab121f7d81c39c8fcd8.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/template-id-2.C | 22 |
4 files changed, 38 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1ec5f1f..a6d4223 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index fa325c0..f2cca5f 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 c339a0d..592508b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 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 0000000..1bc378c --- /dev/null +++ b/gcc/testsuite/g++.dg/template/template-id-2.C @@ -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" } +} |