[Bug c++/104994] extern thread_local declaration rejected in constexpr

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue May 10 08:25:32 GMT 2022


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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:125234a3b78138e22112bb3f207df987817b6818

commit r10-10698-g125234a3b78138e22112bb3f207df987817b6818
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Mar 24 10:12:25 2022 +0100

    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)


More information about the Gcc-bugs mailing list