aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2007-12-18 17:25:20 -0500
committerJason Merrill <jason@gcc.gnu.org>2007-12-18 17:25:20 -0500
commit82390eb63395b769f5708978859b24e3626018d5 (patch)
tree04b92fd03c9a0245d6594119c5231fba022e2334 /gcc
parenta15c0b00b02391adb2aabbf63b0caaa94f01b1dc (diff)
downloadgcc-82390eb63395b769f5708978859b24e3626018d5.zip
gcc-82390eb63395b769f5708978859b24e3626018d5.tar.gz
gcc-82390eb63395b769f5708978859b24e3626018d5.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/pt.c15
-rw-r--r--gcc/testsuite/g++.dg/template/typedef8.C21
3 files changed, 38 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a3bc0ab..c7f0fc4 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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>
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 011ef2f..9f87778 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 0000000..f132606
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/typedef8.C
@@ -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();
+}