https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111004

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Clang's error message is similarly "bad" with GCC's libstdc++:
```
<source>:24:5: error: no matching function for call to 'visit'
   24 |     std::visit([](My_concept auto &&arg) { std::cout << "OK\n"; }, v);
      |     ^~~~~~~~~~
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/14.0.0/../../../../include/c++/14.0.0/variant:1867:5:
note: candidate template ignored: couldn't infer template argument '_Res'
 1867 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/14.0.0/../../../../include/c++/14.0.0/variant:1827:5:
note: candidate template ignored: substitution failure [with _Visitor = (lambda
at <source>:24:16), _Variants = <variant<A, B> &>]: no type named 'type' in
'std::invoke_result<(lambda at <source>:24:16), A &>'
 1827 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^
```

Now LLVM's libc++ produces something which might be helpful:
```
In file included from <source>:2:
In file included from
/opt/compiler-explorer/clang-trunk-20230812/bin/../include/c++/v1/iostream:43:
In file included from
/opt/compiler-explorer/clang-trunk-20230812/bin/../include/c++/v1/ios:222:
In file included from
/opt/compiler-explorer/clang-trunk-20230812/bin/../include/c++/v1/__locale:21:
In file included from
/opt/compiler-explorer/clang-trunk-20230812/bin/../include/c++/v1/mutex:192:
In file included from
/opt/compiler-explorer/clang-trunk-20230812/bin/../include/c++/v1/__condition_variable/condition_variable.h:17:
In file included from
/opt/compiler-explorer/clang-trunk-20230812/bin/../include/c++/v1/__mutex/unique_lock.h:17:
In file included from
/opt/compiler-explorer/clang-trunk-20230812/bin/../include/c++/v1/__system_error/system_error.h:14:
In file included from
/opt/compiler-explorer/clang-trunk-20230812/bin/../include/c++/v1/__system_error/error_category.h:15:
In file included from
/opt/compiler-explorer/clang-trunk-20230812/bin/../include/c++/v1/string:622:
In file included from
/opt/compiler-explorer/clang-trunk-20230812/bin/../include/c++/v1/string_view:1059:
In file included from
/opt/compiler-explorer/clang-trunk-20230812/bin/../include/c++/v1/algorithm:1960:
In file included from
/opt/compiler-explorer/clang-trunk-20230812/bin/../include/c++/v1/iterator:683:
In file included from
/opt/compiler-explorer/clang-trunk-20230812/bin/../include/c++/v1/__iterator/common_iterator.h:31:
/opt/compiler-explorer/clang-trunk-20230812/bin/../include/c++/v1/variant:680:19:
error: static assertion failed due to requirement 'is_invocable_v<(lambda at
<source>:24:16), A &>': `std::visit` requires the visitor to be exhaustive.
  680 |     static_assert(is_invocable_v<_Visitor, _Values...>,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
```
But still no mention of why

Reply via email to