https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96169
Bug ID: 96169 Summary: Don't provide internal lambda names in diagnostics? Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Consider the erroneous program: #include <concepts> #include <string> template <std::regular_invocable<int> F> void call_with_ints(F); void foo() { call_with_ints([](std::string const& s){ return s.size(); }); } This (correctly) doesn't compile, but the tail end of the diagnostic we get is: In file included from <source>:1: /opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/concepts: In instantiation of 'void call_with_ints(F) [with F = foo()::<lambda(const string&)>]': <source>:10:6: required from here /opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/concepts:338:13: required for the satisfaction of 'invocable<_Fn, _Args ...>' [with _Fn = foo::._anon_92; _Args = {int}] /opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/concepts:342:13: required for the satisfaction of 'regular_invocable<F, int>' [with F = foo::._anon_92] /opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/concepts:338:25: note: the expression 'is_invocable_v<_Fn, _Args ...> [with _Fn = foo::._anon_92; _Args = {int}]' evaluated to 'false' 338 | concept invocable = is_invocable_v<_Fn, _Args...>; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Compiler returned: 1 The lambda is initially introduced as "foo()::<lambda(const string&)>" but then throughout the rest of the error is presented as "foo::._anon_92". The former is a useful descriptor, especially in this specific example where the argument the lambda takes is critical in understanding the error. The latter is not useful - it doesn't really tell me anything. Could we use the former name in diagnostics, instead of the latter?