2
0
mirror of https://github.com/boostorg/parser.git synced 2026-01-19 04:22:13 +00:00

Use gross pointer dereference expression to implement detail::whatever

converions operator, since 2/3 of the big three compilers reject the use of
declval() there.
This commit is contained in:
Zach Laine
2025-02-20 23:16:56 -06:00
parent 821d1d4c08
commit 56c81c0b57

View File

@@ -185,14 +185,10 @@ namespace boost { namespace parser {
template<typename T>
operator T() const && noexcept
{
#if defined(__GNUC__) && __GNUC__ < 13
// Yuck.
std::remove_reference_t<T> * ptr = nullptr;
ptr += 1; // warning mitigation
return *ptr;
#else
return std::declval<T>();
#endif
}
};