[PATCH] Fix _GLIBCXX_DEBUG tests

Jonathan Wakely jwakely@redhat.com
Sun Dec 13 22:17:23 GMT 2020


On 13/12/20 15:52 +0100, François Dumont via Libstdc++ wrote:
>Some tests are XPASS because array assertions have been disabled for a 
>good reason in C++11.
>
>I wonder if the respective non-constexpr _GLIBCXX_ASSERTION checks 
>shouldn't target C++14 too. At the moment they are failing as expected 
>but because of an Undefined Behavior no ?

Hmm, maybe my "fix" for the bug was too hasty, and I should have done
this instead:

--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -684,7 +684,7 @@ namespace std
  
  #undef _GLIBCXX_HAS_BUILTIN
  
-#if _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
+#if _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED && __cplusplus >= 201402L
  # define __glibcxx_assert_1(_Condition)                \
      if (__builtin_is_constant_evaluated())     \
       {                                         \

That would allow us to keep the std::array runtime assertions for
C++11, and only disable them in constexpr contexts.


>The other test is failing because of some cleanup in headers which 
>makes <memory> include necessary.
>
>    libstdc++: Fix several _GLIBCXX_DEBUG tests
>
>    libstdc++-v3/ChangeLog:
>
>            * testsuite/23_containers/array/debug/back2_neg.cc: target 
>c++14 because assertion
>            for constexpr is disabled in C++11.
>            * testsuite/23_containers/array/debug/front2_neg.cc: Likewise.
>            * 
>testsuite/23_containers/array/debug/square_brackets_operator2_neg.cc: 
>Likewise.
>            * 
>testsuite/23_containers/vector/debug/multithreaded_swap.cc: Include 
><memory>
>            for shared_ptr.
>
>Ok to commit ?

Yes, thanks.




More information about the Libstdc++ mailing list