]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/66808 (tree check fail in symbol_table::decl_assembler_name_hash)
authorJakub Jelinek <jakub@redhat.com>
Tue, 12 Jan 2016 08:21:53 +0000 (09:21 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 12 Jan 2016 08:21:53 +0000 (09:21 +0100)
PR c++/66808
PR c++/69000
* pt.c (tsubst_decl): If not local_p, clear DECL_TEMPLATE_INFO.

* g++.dg/tls/pr66808.C: New test.
* g++.dg/tls/pr69000.C: New test.

From-SVN: r232259

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

index ba7cf58552cf341f8e7d81f8d6e952aab8843c23..c8b81605f43ca93e0fa0273612fd7e0f6599b2ca 100644 (file)
@@ -1,3 +1,9 @@
+2016-01-12  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/66808
+       PR c++/69000
+       * pt.c (tsubst_decl): If not local_p, clear DECL_TEMPLATE_INFO.
+
 2016-01-11  Jason Merrill  <jason@redhat.com>
 
        PR c++/69131
index ad5099f94bc7941851f22e47cbbdf0cd358e6105..edec774a0c963a8bfe50f6e64cd6b9f0aa1bcfb1 100644 (file)
@@ -12292,8 +12292,13 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
            SET_DECL_IMPLICIT_INSTANTIATION (r);
            register_specialization (r, gen_tmpl, argvec, false, hash);
          }
-       else if (!cp_unevaluated_operand)
-         register_local_specialization (r, t);
+       else
+         {
+           if (DECL_LANG_SPECIFIC (r))
+             DECL_TEMPLATE_INFO (r) = NULL_TREE;
+           if (!cp_unevaluated_operand)
+             register_local_specialization (r, t);
+         }
 
        DECL_CHAIN (r) = NULL_TREE;
 
index 97562b918172a53c58fbcad789d2aa2f4babefe1..1866304b4e334ec5678f0d5529f491dc102a8136 100644 (file)
@@ -1,3 +1,10 @@
+2016-01-12  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/66808
+       PR c++/69000
+       * g++.dg/tls/pr66808.C: New test.
+       * g++.dg/tls/pr69000.C: New test.
+
 2016-01-11  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
        * gcc.target/powerpc/swaps-p8-23.c: New test.
diff --git a/gcc/testsuite/g++.dg/tls/pr66808.C b/gcc/testsuite/g++.dg/tls/pr66808.C
new file mode 100644 (file)
index 0000000..e977987
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/66808
+// { dg-do compile { target c++11 } }
+// { dg-require-effective-target tls }
+
+template <typename>
+class A {
+  int *b = foo ();
+  int *foo () { static __thread int a; return &a; }
+};
+A<int> b;
diff --git a/gcc/testsuite/g++.dg/tls/pr69000.C b/gcc/testsuite/g++.dg/tls/pr69000.C
new file mode 100644 (file)
index 0000000..74cdd4b
--- /dev/null
@@ -0,0 +1,19 @@
+// PR c++/69000
+// { dg-do compile }
+// { dg-require-effective-target tls }
+
+class A {};
+
+template <typename T>
+struct B
+{
+  static int *& foo () { static __thread int *c = 0; return c; }
+};
+
+B<A> d;
+
+void
+bar ()
+{
+  d.foo ();
+}