[Bug c++/97419] crash in decl_as_string(TFF_DECL_SPECIFIERS | TFF_CHASE_TYPEDEF) from plugin using std::declval()
sphink at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Oct 16 15:21:48 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97419
--- Comment #7 from Steve Fink <sphink at gmail dot com> ---
I can workaround the bug by avoiding declval:
- using Iter = decltype(std::declval<const Container>().begin());
- using Elem = decltype(*std::declval<Iter>());
+ using Iter = decltype(static_cast<const Container*>(nullptr)->begin());
+ using Elem = decltype(*static_cast<const Container*>(nullptr)->begin());
fixes it in my original code. In the minimized testcase, it would be the more
pedestrian
- using Iter = typename Container::ValueType*;
- using Elem = decltype(*std::declval<Iter>());
+ using Iter = typename Container::ValueType*;
+ using Elem = typename Container::ValueType;
More information about the Gcc-bugs
mailing list