aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2014-05-06 22:32:49 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2014-05-06 22:32:49 +0000
commit895a5cc06c213d7610dbd8e8433d4bc61cb6738c (patch)
tree8d4b6c1431af99f72ad16052e3ca91cf2a4dda9c /gcc
parent659c0e684c883ab1ac7a5e8eb42c14bee47b3b4c (diff)
downloadgcc-895a5cc06c213d7610dbd8e8433d4bc61cb6738c.zip
gcc-895a5cc06c213d7610dbd8e8433d4bc61cb6738c.tar.gz
gcc-895a5cc06c213d7610dbd8e8433d4bc61cb6738c.tar.bz2
re PR c++/60999 (ICE when static_cast from constexpr in specialization of template-class)
/cp 2014-05-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/60999 * pt.c (maybe_begin_member_template_processing): Use uses_template_parms. /testsuite 2014-05-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/60999 * g++.dg/cpp0x/nsdmi-template9.C: New. * g++.dg/cpp0x/nsdmi-template10.C: Likewise. From-SVN: r210126
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c10
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nsdmi-template10.C14
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nsdmi-template9.C16
4 files changed, 43 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index dce8df6..d3eb4f2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2014-05-06 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/60999
+ * pt.c (maybe_begin_member_template_processing): Use
+ uses_template_parms.
+
2014-05-06 Kenneth Zadeck <zadeck@naturalbridge.com>
Mike Stump <mikestump@comcast.net>
Richard Sandiford <rdsandiford@googlemail.com>
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 7e7f6d8..d9e273e 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -462,9 +462,13 @@ maybe_begin_member_template_processing (tree decl)
bool nsdmi = TREE_CODE (decl) == FIELD_DECL;
if (nsdmi)
- decl = (CLASSTYPE_TEMPLATE_INFO (DECL_CONTEXT (decl))
- ? CLASSTYPE_TI_TEMPLATE (DECL_CONTEXT (decl))
- : NULL_TREE);
+ {
+ tree ctx = DECL_CONTEXT (decl);
+ decl = (CLASSTYPE_TEMPLATE_INFO (ctx)
+ /* Disregard full specializations (c++/60999). */
+ && uses_template_parms (ctx)
+ ? CLASSTYPE_TI_TEMPLATE (ctx) : NULL_TREE);
+ }
if (inline_needs_template_parms (decl, nsdmi))
{
diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi-template10.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi-template10.C
new file mode 100644
index 0000000..4a8c87e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/nsdmi-template10.C
@@ -0,0 +1,14 @@
+// PR c++/60999
+// { dg-do compile { target c++11 } }
+
+struct B
+{
+ template<int N, int M>
+ struct A;
+
+ template<int M>
+ struct A<1, M>
+ {
+ int X = M;
+ };
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi-template9.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi-template9.C
new file mode 100644
index 0000000..0cfbb90
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/nsdmi-template9.C
@@ -0,0 +1,16 @@
+// PR c++/60999
+// { dg-do compile { target c++11 } }
+
+template <typename A>
+struct foo
+{
+};
+
+template<>
+struct foo<int>
+{
+ static constexpr int code = 42;
+ unsigned int bar = static_cast<unsigned int>(code);
+};
+
+foo<int> a;