Specify -fno-builtin when testing to make sure that certain stdlib

functions are not treated as [[nodiscard]].

The compiler might choose to treat them as [[nodiscard]] without the
involvement of libc++ if we allow it to recognize them as builtins.
This commit is contained in:
Richard Smith 2022-04-17 19:39:55 -07:00
parent acfc025a72
commit c105bcbf98
1 changed files with 4 additions and 0 deletions

View File

@ -16,6 +16,10 @@
// be tested here and in nodiscard_extensions.fail.cpp. They should also
// be listed in `UsingLibcxx.rst` in the documentation for the extension.
// Disable any builtin recognition of std::* in the compiler, that might also
// trigger -Wunused-value warnings.
// ADDITIONAL_COMPILE_FLAGS: -fno-builtin
#include <algorithm>
#include <bit> // bit_cast
#include <cstddef> // to_integer