https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97419
Bug ID: 97419
Summary: crash in decl_as_string(TFF_DECL_SPECIFIERS |
TFF_CHASE_TYPEDEF) from plugin using std::declval()
Product: gcc
Version: unknown
Status: UNCONFIRMED
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97419
--- Comment #1 from Steve Fink ---
Created attachment 49369
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49369&action=edit
minimized C++ source
C++ source that only includes .
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97419
--- Comment #2 from Steve Fink ---
Created attachment 49370
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49370&action=edit
Preprocessed source
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97419
--- Comment #3 from Steve Fink ---
This invokes decl_as_string(decl, TFF_DECL_SPECIFIERS | TFF_CHASE_TYPEDEF)
TREE_CODE(decl) is FUNCTION_DECL.
dump_function_decl(decl) is attempting to render the return type of the
function. It's in a local va
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97419
--- Comment #4 from Steve Fink ---
Created attachment 49371
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49371&action=edit
crash stack
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97419
--- Comment #5 from Steve Fink ---
Created attachment 49372
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49372&action=edit
backtrace of crash
Note that the invalid_nonstatic_memfn_p in the attached crash stack seems
bogus. Here's a backt
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97419
--- Comment #6 from Steve Fink ---
The crash still happens with gcc 10.2.0.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97419
--- Comment #7 from Steve Fink ---
I can workaround the bug by avoiding declval:
- using Iter = decltype(std::declval().begin());
- using Elem = decltype(*std::declval());
+ using Iter = decltype(static_cast(nullptr)->begin());
+ using E