public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104994] New: extern thread_local declaration rejected in constexpr
@ 2022-03-20 22:50 hstong at ca dot ibm.com
  2022-03-21 10:37 ` [Bug c++/104994] " jakub at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: hstong at ca dot ibm.com @ 2022-03-20 22:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104994

            Bug ID: 104994
           Summary: extern thread_local declaration rejected in constexpr
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hstong at ca dot ibm.com
  Target Milestone: ---

GCC rejects block-scope extern declarations with the `thread_local` keyword in
constexpr bodies. The relevant wording (prior to removal by P2242
<https://wg21.link/p2242>) prohibits only definitions.


### SOURCE (<stdin>):
constexpr void f() {
  extern thread_local int x;
}


### COMPILER INVOCATION:
g++ -fsyntax-only -std=c++20 -xc++ -


### ACTUAL OUTPUT:
<stdin>: In function 'constexpr void f()':
<stdin>:2:27: error: 'x' declared 'thread_local' in 'constexpr' function only
available with '-std=c++2b' or '-std=gnu++2b'


### EXPECTED OUTPUT:
Clean compile.


### COMPILER VERSION INFO (g++ -v):
Using built-in specs.
COLLECT_GCC=/opt/wandbox/gcc-head/bin/g++
COLLECT_LTO_WRAPPER=/opt/wandbox/gcc-head/libexec/gcc/x86_64-pc-linux-gnu/12.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../source/configure --prefix=/opt/wandbox/gcc-head
--enable-languages=c,c++ --disable-multilib --without-ppl --without-cloog-ppl
--enable-checking=release --disable-nls --enable-lto
LDFLAGS=-Wl,-rpath,/opt/wandbox/gcc-head/lib,-rpath,/opt/wandbox/gcc-head/lib64,-rpath,/opt/wandbox/gcc-head/lib32
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.1 20220319 (experimental) (GCC)

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-05-11  6:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-20 22:50 [Bug c++/104994] New: extern thread_local declaration rejected in constexpr hstong at ca dot ibm.com
2022-03-21 10:37 ` [Bug c++/104994] " jakub at gcc dot gnu.org
2022-03-21 10:44 ` jakub at gcc dot gnu.org
2022-03-21 13:56 ` redi at gcc dot gnu.org
2022-03-21 13:57 ` redi at gcc dot gnu.org
2022-03-21 15:26 ` jakub at gcc dot gnu.org
2022-03-24  9:13 ` cvs-commit at gcc dot gnu.org
2022-03-29  5:54 ` cvs-commit at gcc dot gnu.org
2022-05-10  8:25 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:25 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:36 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).