[gcc r15-7896] libstdc++: Add poison pill for chrono::from_stream
Jonathan Wakely
redi@gcc.gnu.org
Fri Mar 7 20:37:18 GMT 2025
https://gcc.gnu.org/g:4b180459626df64dac758da8760d868c2604ddf2
commit r15-7896-g4b180459626df64dac758da8760d868c2604ddf2
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Mar 6 20:23:29 2025 +0000
libstdc++: Add poison pill for chrono::from_stream
LWG 3956 (approved in Hagenberg, February 2025) decided that from_stream
should be found *only* by ADL, not ordinary unqualified lookup. Add a
poison pill overload to chrono::__detail where the __parsable concept
and operator>>(basic_istream&, _Parser) are defined. This ensures that
when they use from_stream unqualified ordinary lookup finds the poison
pill, which is deleted, so a usable overload resolution result can only
be found by ADL.
We already have the std/time/parse/parse.cc test checking that ADL
works, so this doesn't add a new test.
libstdc++-v3/ChangeLog:
* include/bits/chrono_io.h (chrono::__detail::from_stream): Add
deleted function as poison pill for unqualified lookup.
Reviewed-by: Patrick Palka <ppalka@redhat.com>
Diff:
---
libstdc++-v3/include/bits/chrono_io.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libstdc++-v3/include/bits/chrono_io.h b/libstdc++-v3/include/bits/chrono_io.h
index 8c026586d4c9..c16b555df290 100644
--- a/libstdc++-v3/include/bits/chrono_io.h
+++ b/libstdc++-v3/include/bits/chrono_io.h
@@ -3115,6 +3115,10 @@ namespace __detail
namespace __detail
{
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 3956. chrono::parse uses from_stream as a customization point
+ void from_stream() = delete;
+
template<typename _Parsable, typename _CharT,
typename _Traits = std::char_traits<_CharT>,
typename... _OptArgs>
More information about the Gcc-cvs
mailing list