gcc/libstdc++-v3/testsuite/23_containers/span
Jonathan Wakely 6b42b5a8a2 libstdc++: Use __builtin_unreachable for constexpr assertions [PR 100676]
The current implementation of compile-time precondition checks causes
compilation to fail by calling a non-constexpr function declared at
block scope. This breaks the CUDA compiler, which wraps some libstdc++
headers in a pragma that declares everything as a __host__ __device__
function, but others are not wrapped and so everything is a __host__
function. The local declaration thus gets redeclared as two different
types of function, which doesn't work.

Just use __builtin_unreachable to make constant evaluation fail, instead
of the local function declaration. Also simplify the assertion macros,
which has the side effect of giving simpler compilation errors when
using Clang.

libstdc++-v3/ChangeLog:

	PR libstdc++/100676
	* include/bits/c++config (__glibcxx_assert_1): Rename to ...
	(__glibcxx_constexpr_assert): ... this.
	(__glibcxx_assert_impl): Use __glibcxx_constexpr_assert.
	(__glibcxx_assert): Define as either __glibcxx_constexpr_assert
	or __glibcxx_assert_impl.
	(__glibcxx_assert_2): Remove
	* include/debug/macros.h (_GLIBCXX_DEBUG_VERIFY_AT_F): Use
	__glibcxx_constexpr_assert instead of __glibcxx_assert_1.
	* testsuite/21_strings/basic_string_view/element_access/char/back_constexpr_neg.cc:
	Adjust expected error.
	* 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.
	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/23_containers/span/back_neg.cc: Likewise.
	* testsuite/23_containers/span/front_neg.cc: Likewise.
	* testsuite/23_containers/span/index_op_neg.cc: Likewise.
2021-05-20 20:49:57 +01:00
..
1.cc Update copyright years. 2021-01-04 10:26:59 +01:00
2.cc Update copyright years. 2021-01-04 10:26:59 +01:00
back_assert_neg.cc Update copyright years. 2021-01-04 10:26:59 +01:00
back_neg.cc libstdc++: Use __builtin_unreachable for constexpr assertions [PR 100676] 2021-05-20 20:49:57 +01:00
contiguous_range_neg.cc Update copyright years. 2021-01-04 10:26:59 +01:00
deduction.cc Update copyright years. 2021-01-04 10:26:59 +01:00
everything.cc Update copyright years. 2021-01-04 10:26:59 +01:00
explicit.cc Update copyright years. 2021-01-04 10:26:59 +01:00
first_2_assert_neg.cc Update copyright years. 2021-01-04 10:26:59 +01:00
first_assert_neg.cc Update copyright years. 2021-01-04 10:26:59 +01:00
first_neg.cc Update copyright years. 2021-01-04 10:26:59 +01:00
front_assert_neg.cc Update copyright years. 2021-01-04 10:26:59 +01:00
front_neg.cc libstdc++: Use __builtin_unreachable for constexpr assertions [PR 100676] 2021-05-20 20:49:57 +01:00
index_op_assert_neg.cc Update copyright years. 2021-01-04 10:26:59 +01:00
index_op_neg.cc libstdc++: Use __builtin_unreachable for constexpr assertions [PR 100676] 2021-05-20 20:49:57 +01:00
last_2_assert_neg.cc Update copyright years. 2021-01-04 10:26:59 +01:00
last_assert_neg.cc Update copyright years. 2021-01-04 10:26:59 +01:00
last_neg.cc Update copyright years. 2021-01-04 10:26:59 +01:00
layout_compat.cc Update copyright years. 2021-01-04 10:26:59 +01:00
lwg3255.cc Update copyright years. 2021-01-04 10:26:59 +01:00
nothrow_cons.cc Update copyright years. 2021-01-04 10:26:59 +01:00
subspan_2_assert_neg.cc Update copyright years. 2021-01-04 10:26:59 +01:00
subspan_3_assert_neg.cc Update copyright years. 2021-01-04 10:26:59 +01:00
subspan_4_assert_neg.cc Update copyright years. 2021-01-04 10:26:59 +01:00
subspan_5_assert_neg.cc Update copyright years. 2021-01-04 10:26:59 +01:00
subspan_6_assert_neg.cc Update copyright years. 2021-01-04 10:26:59 +01:00
subspan_assert_neg.cc Update copyright years. 2021-01-04 10:26:59 +01:00
subspan_neg.cc Update copyright years. 2021-01-04 10:26:59 +01:00