On Fri, 6 Mar 2026 at 10:49, Nathan Myers <[email protected]> wrote:
>
> [This is untested. How do I find g++.old-deja/g++.martin/bitset1.C ?]

With /usr/bin/find :-)

For the compiler tests the general rule is to find the test under
gcc/testsuite then locate the .exp file that runs it, which will be
first .exp file you find if you look in . then .. then ../.. etc.
So for gcc/testsuite/g++.old-deja/g++.martin/bitset1.C that's
gcc/testsuite/g++.old-deja/old-deja.exp

So then you use RUNTESTFLAGS=old-deja.exp=bitset1.C

The 'make check-g++' target limits it to the C++ tests, but 'make
check' works too (just slower).


>
> C++11 forbids a compound statement, as seen in the definition of
> __glibcxx_assert(), in a constexpr function. This patch implements
> the assertion in `bitset<>::operator[] const` directly for C++11,
> albeit less ergonomically.
>
> libstdc++-v3/ChangeLog:
>         * include/std/bitset (operator[]() const): Customize bounds
>         check for C++11 case.
> ---
>  libstdc++-v3/include/std/bitset | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset
> index eb200ab9246..a23545320ee 100644
> --- a/libstdc++-v3/include/std/bitset
> +++ b/libstdc++-v3/include/std/bitset
> @@ -1298,8 +1298,16 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
>        _GLIBCXX_CONSTEXPR bool
>        operator[](size_t __position) const
>        {
> +#if __cplusplus != 201103L
>         __glibcxx_assert(__position < _Nb);
>         return _Unchecked_test(__position);
> +#elif defined(_GLIBCXX_ASSERTIONS)
> +       // C++11 forbids a compound stmt in a constexpr function.
> +       return __position < _Nb ? _Unchecked_test(__position)
> +         : (__builtin_trap(), bool());

I think I'd prefer just 'false' instead of 'bool()'

OK with that change after tests pass, thanks.



> +#else
> +       return _Unchecked_test(__position);
> +#endif
>        }
>        ///@}
>
> --
> 2.52.0
>

Reply via email to