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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:72124f487ccb5c8065dd5f7b8fba254600b7e611

commit r12-7793-g72124f487ccb5c8065dd5f7b8fba254600b7e611
Author: Jakub Jelinek <ja...@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.

    The following patch implements the proposed wording of CWG 2552 in addition
    to fixing the C++14 - C++20 handling bug.
    If you'd like instead to keep the current pedantic C++23 wording for now,
    that would mean taking out the first hunk (cxx_eval_constant_expression)
and
    g++.dg/cpp23/constexpr-nonlit2.C hunk.

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

            PR c++/104994
            * constexpr.cc (cxx_eval_constant_expression): Don't diagnose
passing
            through extern thread_local declarations.  Change wording from
            declaration to definition.
            (potential_constant_expression_1): Don't diagnose extern
thread_local
            declarations.  Change wording from declared to defined.
            * decl.cc (start_decl): Likewise.

            * g++.dg/diagnostic/constexpr1.C: Change expected diagnostic
wording
            from declared to defined.
            * g++.dg/cpp23/constexpr-nonlit1.C: Likewise.
            (garply): Change dg-error into dg-bogus.
            * g++.dg/cpp23/constexpr-nonlit2.C: Change expected diagnostic
wording
            from declaration to definition.
            * g++.dg/cpp23/constexpr-nonlit6.C: Change expected diagnostic
wording
            from declared to defined.
            * g++.dg/cpp23/constexpr-nonlit7.C: New test.
            * g++.dg/cpp2a/constexpr-try5.C: Change expected diagnostic wording
            from declared to defined.
            * g++.dg/cpp2a/consteval3.C: Likewise.

Reply via email to