https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96877
Bug ID: 96877 Summary: Erroneous warning when default initializing function pointer types defined using std::declval Product: gcc Version: 10.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: insertinterestingnamehere at gmail dot com Target Milestone: --- When compiling the following with -Wextra (C++11 and later, all recent version of gcc) the compiler emits an erroneous warning about binding a temporary in a constructor. Note: this works fine if function_type is declared as a plain typedef instead of using decltype and std::declval. See https://godbolt.org/z/sjKdP5. #include <utility> using function_type = decltype(std::declval<void (*)(void*) noexcept>()); struct S { function_type fptr = nullptr; }; int main() { S thing; }