libstdc++: Enable dangling checks in std::pair and std::tuple [PR108822]

In r13-6084-g916ce577ad109b I enabled the dangling-reference checks in
std::pair unconditionally for C++20 (which was experimental at the time)
but conditional on _GLIBCXX_DEBUG for C++17 and lower, saying:

  The pre-C++17 assertions are only enabled for Debug Mode, to avoid
  introducing a breaking change in Stage 4. We should consider enabling
  them by default in Stage 1 for GCC 14.

In r14-7225-gf8a5298c97c460 I added the checks to std::tuple, again
making them conditional on _GLIBCXX_DEBUG for C++17 and lower. We never
revisited that during Stage 1 to remove the _GLIBCXX_DEBUG condition.

I'm not aware of problems caused by making it ill-formed to create pairs
and tuples with dangling references, so this commit removes the
_GLIBCXX_DEBUG condition. This makes it ill-formed to create a std::pair
or std::tuple that would have guaranteed UB if its element was accessed
at runtime. Programs which use such types in code which is never
executed should either remove the code, or use std::declval in
unevaluated contexts, to avoid instantiating the ill-formed
constructors.

libstdc++-v3/ChangeLog:

	PR libstdc++/108822
	* include/bits/stl_pair.h (__glibcxx_no_dangling_refs): Enable
	for normal mode, not only Debug Mode.
	* include/std/tuple (__glibcxx_no_dangling_refs): Likewise.

Reviewed-by: Tomasz KamiƄski <tkaminsk@redhat.com>
2 files changed