re PR c++/71450 (ICE on invalid C++11 code on x86_64-linux-gnu: in tree check: expect...
authorJakub Jelinek <jakub@redhat.com>
Wed, 23 Nov 2016 15:59:25 +0000 (16:59 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 23 Nov 2016 15:59:25 +0000 (16:59 +0100)
PR c++/71450
* pt.c (tsubst_copy): Return error_mark_node when mark_used
fails, even when complain & tf_error.

* g++.dg/cpp0x/pr71450-1.C: New test.
* g++.dg/cpp0x/pr71450-2.C: New test.

From-SVN: r242767

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

index 66ea957..7418b22 100644 (file)
@@ -1,5 +1,9 @@
 2016-11-23  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/71450
+       * pt.c (tsubst_copy): Return error_mark_node when mark_used
+       fails, even when complain & tf_error.
+
        PR c++/77739
        * cp-gimplify.c (cp_gimplify_tree) <case VEC_INIT_EXPR>: Pass
        false as handle_invisiref_parm_p to cp_genericize_tree.
index 6a68de2..8b0a21c 100644 (file)
@@ -14297,7 +14297,7 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
        }
       else
        r = t;
-      if (!mark_used (r, complain) && !(complain & tf_error))
+      if (!mark_used (r, complain))
        return error_mark_node;
       return r;
 
index ca673ee..6abbd3b 100644 (file)
@@ -1,5 +1,9 @@
 2016-11-23  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/71450
+       * g++.dg/cpp0x/pr71450-1.C: New test.
+       * g++.dg/cpp0x/pr71450-2.C: New test.
+
        PR c++/77739
        * g++.dg/cpp1y/pr77739.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr71450-1.C b/gcc/testsuite/g++.dg/cpp0x/pr71450-1.C
new file mode 100644 (file)
index 0000000..1c68629
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/71450
+// { dg-do compile { target c++11 } }
+
+struct A { A operator+ (A a) { return a; } };
+
+template <class T>
+void foo (T t)
+{ 
+  auto x = t + x;      // { dg-error "use of 'x' before deduction of 'auto'" }
+}
+
+int
+main ()
+{ 
+  foo (A ());
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr71450-2.C b/gcc/testsuite/g++.dg/cpp0x/pr71450-2.C
new file mode 100644 (file)
index 0000000..1a7376c
--- /dev/null
@@ -0,0 +1,14 @@
+// PR c++/71450
+// { dg-do compile { target c++11 } }
+
+template <class T>
+void foo (T t)
+{ 
+  auto x = t + x;      // { dg-error "use of 'x' before deduction of 'auto'" }
+}
+
+int
+main ()
+{ 
+  foo (1);
+}