aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2023-12-05 10:22:17 +0000
committerJonathan Wakely <jwakely@redhat.com>2023-12-05 23:33:22 +0000
commit5e8a30d8b8f4d7ea0a8340b46c1e0c865dbde781 (patch)
tree39f8e3ed38235051a45cfef65eda4d27db042433 /gcc/testsuite/c-c++-common
parent2e7abd09621a4401d44f4513adf126bce4b4828b (diff)
downloadgcc-5e8a30d8b8f4d7ea0a8340b46c1e0c865dbde781.zip
gcc-5e8a30d8b8f4d7ea0a8340b46c1e0c865dbde781.tar.gz
gcc-5e8a30d8b8f4d7ea0a8340b46c1e0c865dbde781.tar.bz2
libstdc++: Redefine __glibcxx_assert to work in C++23 constexpr
The changes in r14-5979 to support unknown references in constant expressions caused some test regressions. The way that __glibcxx_assert is defined for constant evaluation no longer works when _GLIBCXX_ASSERTIONS is defined. This change simplifies __glibcxx_assert so that there is only one check, rather than a constexpr one and a conditionally-enabled runtime one. The constexpr one does not need to use __builtin_unreachable to cause a compilation failure, because __glibcxx_assert_fail is not usable in constant expressions, so that will cause a failure too. As well as fixing the regressions, this makes the code for the assertions shorter and simpler, so should be quicker to compile, and might inline better too. libstdc++-v3/ChangeLog: * include/bits/c++config (__glibcxx_assert_fail): Declare even when assertions are not enabled. (__glibcxx_constexpr_assert): Remove macro. (__glibcxx_assert_impl): Remove macro. (_GLIBCXX_ASSERT_FAIL): New macro. (_GLIBCXX_DO_ASSERT): New macro. (__glibcxx_assert): Simplify to a single definition that works at runtime and during constant evaluation. * testsuite/21_strings/basic_string_view/element_access/char/back_constexpr_neg.cc: Adjust expected errors. * testsuite/21_strings/basic_string_view/element_access/char/constexpr_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/char/front_constexpr_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/back_constexpr_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/constexpr_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/front_constexpr_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/modifiers/remove_prefix/debug.cc: Likewise. * testsuite/21_strings/basic_string_view/modifiers/remove_suffix/debug.cc: Likewise. * testsuite/23_containers/span/back_neg.cc: Likewise. * testsuite/23_containers/span/front_neg.cc: Likewise. * testsuite/23_containers/span/index_op_neg.cc: Likewise. * testsuite/26_numerics/lcm/105844.cc: Likewise.
Diffstat (limited to 'gcc/testsuite/c-c++-common')
0 files changed, 0 insertions, 0 deletions