https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109083
Bug ID: 109083 Summary: Incorrect static_assert shown in diagnostics Product: gcc Version: 12.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: markus-t314 at gmx dot de Target Milestone: --- Code: #include <type_traits> template<typename T> void unused_function() { static_assert(std::is_member_function_pointer<decltype(&T::foo)>::value, "Line 6"); } template<typename T> void fail_here() { static_assert(std::is_member_function_pointer<decltype(&T::foo)>::value, "Line 12"); } int main() { fail_here<int>(); } This fails correctly, but the wrong static assertion is given in diagnostics: main.cpp: In instantiation of ‘void fail_here() [with T = int]’: main.cpp:17:19: required from here main.cpp:6:60: error: ‘foo’ is not a member of ‘int’ 6 | static_assert(std::is_member_function_pointer<decltype(&T::foo)>::value, "Line 6"); | https://godbolt.org/z/6Yrc9x6Ws Might be related to bug 66968