aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@redhat.com>2010-02-05 08:28:24 +0000
committerDodji Seketeli <dodji@gcc.gnu.org>2010-02-05 09:28:24 +0100
commit3cdabe3b06bff9dc051aa5ba6f9056bdc8e743b6 (patch)
tree8b5b4721fdc94bb4b1c75d09141fc2ef0055594c /gcc
parent430f2d1f6fcde2ccbf5ae935e15e13f0bb3e8c4c (diff)
downloadgcc-3cdabe3b06bff9dc051aa5ba6f9056bdc8e743b6.zip
gcc-3cdabe3b06bff9dc051aa5ba6f9056bdc8e743b6.tar.gz
gcc-3cdabe3b06bff9dc051aa5ba6f9056bdc8e743b6.tar.bz2
re PR c++/42915 (ICE: same canonical type node for different types in recent builds)
Fix PR c++/42915 gcc/cp/ChangeLog: PR c++/42915 * typeck.c (get_template_parms_of_dependent_type): Try getting the template parameters fromt the type itself first. gcc/testsuite/ChangeLog: PR c++/42915 g++.dg/other/crash-9.C: New test. From-SVN: r156514
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/typeck.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/other/crash-9.C15
4 files changed, 31 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 5ae5ac6..893bd9d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2010-02-05 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/42915
+ * typeck.c (get_template_parms_of_dependent_type): Try getting
+ the template parameters fromt the type itself first.
+
2010-02-03 Jason Merrill <jason@redhat.com>
PR c++/4926
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 36f3065..18d56f4 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -1106,9 +1106,13 @@ get_template_parms_of_dependent_type (tree t)
{
tree tinfo = NULL_TREE, tparms = NULL_TREE;
+ /* First, try the obvious case of getting the
+ template info from T itself. */
+ if ((tinfo = get_template_info (t)))
+ ;
/* If T1 is a typedef or whatever has a template info associated
to its context, get the template parameters from that context. */
- if (typedef_variant_p (t)
+ else if (typedef_variant_p (t)
&& DECL_CONTEXT (TYPE_NAME (t))
&& !NAMESPACE_SCOPE_P (TYPE_NAME (t)))
tinfo = get_template_info (DECL_CONTEXT (TYPE_NAME (t)));
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 94ccbc4..c8a911a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-02-05 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/42915
+ g++.dg/other/crash-9.C: New test.
+
2010-02-05 Paul Thomas <pault@gcc.gnu.org>
PR fortran/42309
diff --git a/gcc/testsuite/g++.dg/other/crash-9.C b/gcc/testsuite/g++.dg/other/crash-9.C
new file mode 100644
index 0000000..0953fcb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/crash-9.C
@@ -0,0 +1,15 @@
+// Origin: PR c++/42915
+// { dg-do compile }
+
+template <typename T>
+class A
+{
+ template <typename U>
+ class B
+ {
+ B foo();
+ };
+};
+template <typename T> template <typename U>
+A<T>::B<U> A<T>::B<U>::foo() {}
+