+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>
/* 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;
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 ... */
--- /dev/null
+// 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();
+}