/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 29 Jan 2014 17:54:51 +0000 (17:54 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 29 Jan 2014 17:54:51 +0000 (17:54 +0000)
2014-01-29  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/58674
* pt.c (instantiate_template_1): Check for error_mark_node the second
argument too.

/testsuite
2014-01-29  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/58674
* g++.dg/cpp0x/pr58674.C: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207275 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/pr58674.C [new file with mode: 0644]

index 594861b..ff6493a 100644 (file)
@@ -1,3 +1,9 @@
+2014-01-29  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/58674
+       * pt.c (instantiate_template_1): Check for error_mark_node the second
+       argument too.
+
 2014-01-29  Jason Merrill  <jason@redhat.com>
 
        PR c++/59916
index 7f1b6d5..ce679f6 100644 (file)
@@ -15258,6 +15258,9 @@ instantiate_template_1 (tree tmpl, tree orig_args, tsubst_flags_t complain)
       return NULL_TREE;
     }
 
+  if (targ_ptr == error_mark_node)
+    return error_mark_node;
+
   /* Check to see if we already have this specialization.  */
   gen_tmpl = most_general_template (tmpl);
   if (tmpl != gen_tmpl)
index 0b832ad..ce325ca 100644 (file)
@@ -1,3 +1,8 @@
+2014-01-29  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/58674
+       * g++.dg/cpp0x/pr58674.C: New.
+
 2014-01-28  Kirill Yukhin  <kirill.yukhin@intel.com>
 
         PR target/59617
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr58674.C b/gcc/testsuite/g++.dg/cpp0x/pr58674.C
new file mode 100644 (file)
index 0000000..fe97c6d
--- /dev/null
@@ -0,0 +1,18 @@
+// PR c++/58674
+// { dg-do compile { target c++11 } }
+
+template<int> struct A {};
+
+template<int N> using B = A<N>;
+
+template<typename T> struct C
+{
+  B<T::i> b;  // { dg-error "not usable" }
+};
+
+struct X
+{
+  static const int i;
+};
+
+C<X> c;