diff options
author | Mark Mitchell <mark@codesourcery.com> | 1999-03-19 12:13:39 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 1999-03-19 12:13:39 +0000 |
commit | b03a08ee0f0d0c64d3d0df60730d078b26c49876 (patch) | |
tree | ae9bc1a9a4915b51030124de413656a1225981e5 /gcc | |
parent | 91813b2835a919d45b2244e0f31f8dc3165ad379 (diff) | |
download | gcc-b03a08ee0f0d0c64d3d0df60730d078b26c49876.zip gcc-b03a08ee0f0d0c64d3d0df60730d078b26c49876.tar.gz gcc-b03a08ee0f0d0c64d3d0df60730d078b26c49876.tar.bz2 |
init.c (build_member_call): Handle template-id expressions correctly.
* init.c (build_member_call): Handle template-id expressions
correctly.
* typeck.c (build_x_function_call): Likewise.
From-SVN: r25859
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/init.c | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 16 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/crash31.C | 19 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/memtemp82.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/memtemp83.C | 19 |
6 files changed, 59 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1876601..384e3e9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +1999-03-19 Mark Mitchell <mark@codesourcery.com> + + * init.c (build_member_call): Handle template-id expressions + correctly. + * typeck.c (build_x_function_call): Likewise. + 1999-03-19 Chip Salzenberg <chip@perlsupport.com> * friend.c (make_friend_class): Avoid core dump when diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 98f26f5..e469661 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -1381,7 +1381,11 @@ build_member_call (type, name, parmlist) if (TREE_CODE (name) != TEMPLATE_ID_EXPR) method_name = name; else - method_name = TREE_OPERAND (name, 0); + { + method_name = TREE_OPERAND (name, 0); + if (is_overloaded_fn (method_name)) + method_name = DECL_NAME (OVL_CURRENT (method_name)); + } if (TREE_CODE (method_name) == BIT_NOT_EXPR) { diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 0732bc8..cfd9319 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2585,6 +2585,15 @@ build_x_function_call (function, params, decl) TYPE_BINFO (type), LOOKUP_NORMAL); } + if ((TREE_CODE (function) == FUNCTION_DECL + && DECL_STATIC_FUNCTION_P (function)) + || (TREE_CODE (function) == TEMPLATE_DECL + && DECL_STATIC_FUNCTION_P (DECL_RESULT (function)))) + return build_member_call(DECL_CONTEXT (function), + template_id + ? template_id : DECL_NAME (function), + params); + is_method = ((TREE_CODE (function) == TREE_LIST && current_class_type != NULL_TREE && (IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (function)) @@ -2593,13 +2602,6 @@ build_x_function_call (function, params, decl) || TREE_CODE (type) == METHOD_TYPE || TYPE_PTRMEMFUNC_P (type)); - if ((TREE_CODE (function) == FUNCTION_DECL - && DECL_STATIC_FUNCTION_P (function)) - || (TREE_CODE (function) == TEMPLATE_DECL - && DECL_STATIC_FUNCTION_P (DECL_RESULT (function)))) - return build_member_call - (DECL_CONTEXT (function), DECL_NAME (function), params); - /* A friend template. Make it look like a toplevel declaration. */ if (! is_method && TREE_CODE (function) == TEMPLATE_DECL) function = scratch_ovl_cons (function, NULL_TREE); diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash31.C b/gcc/testsuite/g++.old-deja/g++.pt/crash31.C new file mode 100644 index 0000000..3475896 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash31.C @@ -0,0 +1,19 @@ +// Build don't link: +// Origin: Corey Kosak + +struct cow_t { + template<bool Q> + static void tfunc(cow_t *cowp) {} + + void moo() { + cow_t *cowp; + cow_t::tfunc<true>(cowp); + } +}; + + +int main() +{ + cow_t *cowp; + cow_t::tfunc<true>(cowp); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp82.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp82.C index 9abd390..d4bb37a 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/memtemp82.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp82.C @@ -1,5 +1,5 @@ // Build don't link: -// excess errors test - XFAIL *-*-* +// excess errors test struct foo { template<typename T> T bar() { return staticbar<T>( this ); } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp83.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp83.C new file mode 100644 index 0000000..69ab948 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp83.C @@ -0,0 +1,19 @@ +// Build don't link: +// Origin: Corey Kosak <kosak@cs.cmu.edu> + +struct cow_t { + template<bool Q> + static void tfunc(cow_t *cowp) {} + + void moo() { + cow_t *cowp; + tfunc<true>(cowp); + } +}; + + +int main() +{ + cow_t *cowp; + cow_t::tfunc<true>(cowp); +} |