From: Jason Merrill Date: Tue, 18 Dec 2007 22:25:20 +0000 (-0500) Subject: re PR c++/34206 (ICE in retrieve_local_specialization) X-Git-Tag: releases/gcc-4.3.0~905 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=82390eb63395b769f5708978859b24e3626018d5;p=thirdparty%2Fgcc.git re PR c++/34206 (ICE in retrieve_local_specialization) PR c++/34206 * pt.c (tsubst_aggr_type): Do nothing if the type already doesn't use template parms. (dependent_type_p_r): Handle the domain of an array. From-SVN: r131044 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a3bc0ab96b7f..c7f0fc488cac 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2007-12-18 Jason Merrill + + PR c++/34206 + * pt.c (tsubst_aggr_type): Do nothing if the type already doesn't + use template parms. + (dependent_type_p_r): Handle the domain of an array. + 2007-12-18 Douglas Gregor Jakub Jelinek diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 011ef2fbc032..9f87778fc441 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -7638,7 +7638,7 @@ tsubst_aggr_type (tree t, /* Else fall through. */ case ENUMERAL_TYPE: case UNION_TYPE: - if (TYPE_TEMPLATE_INFO (t)) + if (TYPE_TEMPLATE_INFO (t) && uses_template_parms (t)) { tree argvec; tree context; @@ -15455,13 +15455,18 @@ dependent_type_p_r (tree type) if (TREE_CODE (type) == ARRAY_TYPE) { if (TYPE_DOMAIN (type) - && ((value_dependent_expression_p - (TYPE_MAX_VALUE (TYPE_DOMAIN (type)))) - || (type_dependent_expression_p - (TYPE_MAX_VALUE (TYPE_DOMAIN (type)))))) + && dependent_type_p (TYPE_DOMAIN (type))) return true; return dependent_type_p (TREE_TYPE (type)); } + else if (TREE_CODE (type) == INTEGER_TYPE + && !TREE_CONSTANT (TYPE_MAX_VALUE (type))) + { + /* If this is the TYPE_DOMAIN of an array type, consider it + dependent. */ + return (value_dependent_expression_p (TYPE_MAX_VALUE (type)) + || type_dependent_expression_p (TYPE_MAX_VALUE (type))); + } /* -- a template-id in which either the template name is a template parameter ... */ diff --git a/gcc/testsuite/g++.dg/template/typedef8.C b/gcc/testsuite/g++.dg/template/typedef8.C new file mode 100644 index 000000000000..f132606889b4 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/typedef8.C @@ -0,0 +1,21 @@ +// PR c++/34206 + +template struct pair { }; +template struct tuple { + template + tuple& operator=(const pair& k) { } +}; +template inline tuple tie(T1& t1, T2& t2) { } + +template struct A +{ + typedef T type; + pair f(); +}; + +void g(A a) +{ + typedef A::type type; + type begin1, end1; + tie(begin1, end1) = a.f(); +}