]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: extern thread_local declarations in constexpr [PR104994]
authorJakub Jelinek <jakub@redhat.com>
Thu, 24 Mar 2022 09:12:25 +0000 (10:12 +0100)
committerJakub Jelinek <jakub@redhat.com>
Wed, 11 May 2022 06:17:57 +0000 (08:17 +0200)
commit54bccc8e05f6f9480b50c4edfb2a364d344e72c0
tree28470fdd85b7974655d55deb7439b9302113f76e
parentc1a8261b7054da31420e5c715e682c1b42e473b5
c++: extern thread_local declarations in constexpr [PR104994]

C++14 to C++20 apparently should allow extern thread_local declarations in
constexpr functions, however useless they are there (because accessing
such vars is not valid in a constant expression, perhaps sizeof/decltype).
P2242 changed that for C++23 to passing through declaration but
https://cplusplus.github.io/CWG/issues/2552.html
has been filed for it yesterday.

2022-03-24  Jakub Jelinek  <jakub@redhat.com>

PR c++/104994
* constexpr.c (potential_constant_expression_1): Don't diagnose extern
thread_local declarations.
* decl.c (start_decl): Likewise.

* g++.dg/cpp2a/constexpr-nonlit7.C: New test.

(cherry picked from commit 72124f487ccb5c8065dd5f7b8fba254600b7e611)
gcc/cp/constexpr.c
gcc/cp/decl.c
gcc/testsuite/g++.dg/cpp2a/constexpr-nonlit7.C [new file with mode: 0644]