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
This commit is contained in:
Jason Merrill 2007-12-18 17:25:20 -05:00 committed by Jason Merrill
parent a15c0b00b0
commit 82390eb633
3 changed files with 38 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2007-12-18 Jason Merrill <jason@redhat.com>
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 <doug.gregor@gmail.com>
Jakub Jelinek <jakub@redhat.com>

View File

@ -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 ... */

View File

@ -0,0 +1,21 @@
// PR c++/34206
template<class _T1, class _T2> struct pair { };
template <class T0, class T1> struct tuple {
template <class U1, class U2>
tuple& operator=(const pair<U1, U2>& k) { }
};
template<class T1, class T2> inline tuple<T1&, T2&> tie(T1& t1, T2& t2) { }
template <class T> struct A
{
typedef T type;
pair<type, type> f();
};
void g(A<int> a)
{
typedef A<int>::type type;
type begin1, end1;
tie(begin1, end1) = a.f();
}