This testcase used to ICE but was fixed by r259067.  We now issue

67533.C:5:26: error: conversion from ‘void’ to non-scalar type ‘Tls’ requested
    5 | thread_local Tls mytls = mytls; // { dg-error "" }
      |                          ^~~~~

whereas clang++ and icc compile it.  However, the test uses a reserved 
identifier
([lex.name]/3), and I think the error is fine.

Do you think it's worth adding this test?  I thought so, just to check we don't
ICE, but who uses a mangled name as an identifier?!

Tested x86_64-linux, ok for trunk?

2019-06-09  Marek Polacek  <pola...@redhat.com>

        PR c++/67533
        * g++.dg/tls/thread_local-ice5.C: New test.

diff --git gcc/testsuite/g++.dg/tls/thread_local-ice5.C 
gcc/testsuite/g++.dg/tls/thread_local-ice5.C
new file mode 100644
index 00000000000..4147c322e7b
--- /dev/null
+++ gcc/testsuite/g++.dg/tls/thread_local-ice5.C
@@ -0,0 +1,7 @@
+// PR c++/67533
+// { dg-do compile { target c++11 } }
+// { dg-require-effective-target tls }
+
+struct Tls {};
+void _ZTW5mytls();
+thread_local Tls mytls = mytls; // { dg-error "" }

Reply via email to