summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-04 09:49:45 +0000
committerdodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-04 09:49:45 +0000
commit22471cfe8db5f413e4abd666b32a2b2cbda341a8 (patch)
tree172380cb649bc9cd1a9292ccd5322655d0bfeb35
parent7d3f46726022d414cb0d64b71daf3ce048bc0fcb (diff)
downloadppe42-gcc-22471cfe8db5f413e4abd666b32a2b2cbda341a8.tar.gz
ppe42-gcc-22471cfe8db5f413e4abd666b32a2b2cbda341a8.zip
Fix PR c++/43953
gcc/cp/ChangeLog: PR c++/43953 * pt.c (most_specialized_class): Pretend we are processing a template decl during the call to coerce_template_parms. gcc/testsuite/ChangeLog: PR c++/43953 * g++.dg/other/crash-12.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159019 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/other/crash-12.C25
4 files changed, 41 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 23e55567c27..026abe8254d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2010-05-03 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/43953
+ * pt.c (most_specialized_class): Pretend we are processing
+ a template decl during the call to coerce_template_parms.
+
2010-05-03 Jason Merrill <jason@redhat.com>
PR c++/42810
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 29489b6337c..fbf9b905c02 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -15941,12 +15941,13 @@ most_specialized_class (tree type, tree tmpl)
tree parms = TREE_VALUE (t);
partial_spec_args = CLASSTYPE_TI_ARGS (TREE_TYPE (t));
+
+ ++processing_template_decl;
+
if (outer_args)
{
int i;
- ++processing_template_decl;
-
/* Discard the outer levels of args, and then substitute in the
template args from the enclosing class. */
partial_spec_args = INNERMOST_TEMPLATE_ARGS (partial_spec_args);
@@ -15963,7 +15964,6 @@ most_specialized_class (tree type, tree tmpl)
TREE_VEC_ELT (parms, i) =
tsubst (TREE_VEC_ELT (parms, i), outer_args, tf_none, NULL_TREE);
- --processing_template_decl;
}
partial_spec_args =
@@ -15974,6 +15974,8 @@ most_specialized_class (tree type, tree tmpl)
/*require_all_args=*/true,
/*use_default_args=*/true);
+ --processing_template_decl;
+
if (partial_spec_args == error_mark_node)
return error_mark_node;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d3d168fe621..4c7f13da789 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-05-03 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/43953
+ * g++.dg/other/crash-12.C: New test.
+
2010-05-03 H.J. Lu <hongjiu.lu@intel.com>
* g++.dg/cdce3.C: Add a space. Updated.
diff --git a/gcc/testsuite/g++.dg/other/crash-12.C b/gcc/testsuite/g++.dg/other/crash-12.C
new file mode 100644
index 00000000000..6612ff216ba
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/crash-12.C
@@ -0,0 +1,25 @@
+// Origin: PR c++/43953
+
+template<typename T,
+ typename U,
+ typename T::type V> class bad;
+
+// partial specialization
+// for T = U
+template<typename T, typename T::type V>
+class bad<T, T, V>
+{
+public:
+ static void foo() {}
+};
+
+struct dummy
+{
+ typedef int type;
+};
+
+int main()
+{
+ bad<dummy, dummy, 0>::foo();
+}
+
OpenPOWER on IntegriCloud