aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2003-06-20 05:52:43 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2003-06-20 05:52:43 +0000
commit00cf3e31fd7934e7876c096e85b39e38c05275fc (patch)
tree7b1a1427ec2e377d2ea72a73a148655cd4165f8a /gcc/cp
parente2b9853b291bb738919adb4e31990135a6e677e1 (diff)
downloadgcc-00cf3e31fd7934e7876c096e85b39e38c05275fc.zip
gcc-00cf3e31fd7934e7876c096e85b39e38c05275fc.tar.gz
gcc-00cf3e31fd7934e7876c096e85b39e38c05275fc.tar.bz2
re PR c++/10939 (ICE with templated code)
PR c++/10939 * pt.c (tsubst_decl): Do not try to substitute into non-dependent functions. (value_dependent_expression_p): Correct logic for FUNCTION_DECLs. PR c++/10939 * g++.dg/template/func1.C: New test. From-SVN: r68244
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/pt.c15
2 files changed, 18 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ba7bc03..32532d8 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,10 @@
2003-06-19 Mark Mitchell <mark@codesourcery.com>
+ PR c++/10939
+ * pt.c (tsubst_decl): Do not try to substitute into non-dependent
+ functions.
+ (value_dependent_expression_p): Correct logic for FUNCTION_DECLs.
+
PR c++/9649
* cp-tree.h (pushdecl_class_level): Change prototype.
(push_class_level_binding): Likewise.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index b5ac7b2..1a43d02 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -5909,6 +5909,17 @@ tsubst_decl (tree t, tree args, tree type, tsubst_flags_t complain)
if (TREE_CODE (DECL_TI_TEMPLATE (t)) == TEMPLATE_DECL)
{
tree spec;
+ bool dependent_p;
+
+ /* If T is not dependent, just return it. We have to
+ increment PROCESSING_TEMPLATE_DECL because
+ value_dependent_expression_p assumes that nothing is
+ dependent when PROCESSING_TEMPLATE_DECL is zero. */
+ ++processing_template_decl;
+ dependent_p = value_dependent_expression_p (t);
+ --processing_template_decl;
+ if (!dependent_p)
+ return t;
/* Calculate the most general template of which R is a
specialization, and the complete set of arguments used to
@@ -11368,8 +11379,8 @@ value_dependent_expression_p (tree expression)
/* A name declared with a dependent type. */
if (TREE_CODE (expression) == LOOKUP_EXPR
- || (DECL_P (expression)
- && dependent_type_p (TREE_TYPE (expression))))
+ || (DECL_P (expression)
+ && type_dependent_expression_p (expression)))
return true;
/* A non-type template parameter. */
if ((TREE_CODE (expression) == CONST_DECL