aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.cc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2022-03-24 10:12:25 +0100
committerJakub Jelinek <jakub@redhat.com>2022-03-24 10:12:25 +0100
commit72124f487ccb5c8065dd5f7b8fba254600b7e611 (patch)
tree8de82fe3cbd553d06bbcba957c4685e2a51f5a3e /gcc/fold-const.cc
parent497bde3ab92b2c292f78672db341bbb7cc1bcf1f (diff)
downloadgcc-72124f487ccb5c8065dd5f7b8fba254600b7e611.zip
gcc-72124f487ccb5c8065dd5f7b8fba254600b7e611.tar.gz
gcc-72124f487ccb5c8065dd5f7b8fba254600b7e611.tar.bz2
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 <jakub@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.
Diffstat (limited to 'gcc/fold-const.cc')
0 files changed, 0 insertions, 0 deletions