clang-concepts-monorepo icon indicating copy to clipboard operation
clang-concepts-monorepo copied to clipboard

Terse syntax does not work with lambdas

Open davidstone opened this issue 5 years ago • 1 comments

The following translation unit has several problems:

template<typename>
concept one = true;

template<typename, typename>
concept two = true;

auto accepts_1 = [](one auto) {};
auto should_reject_1 = [](one<int> auto) {};

auto rejects_2_0 = [](two auto) {};
auto should_accept_2_1 = [](two<int> auto) {};
auto rejects_2_2 = [](two<int, int> auto) {};
auto rejects_2_3 = [](two<int, int, int> auto) {};

It fails to reject should_reject_1. It fails to accept should_accept_2_1. Every version that it rejects, whether properly or improperly, it gives the same unhelpful error message: error: too few template arguments for concept '[whatever the concept name is]'. It gives this message even if the problem is that you passed too many arguments. The error message also fails to say which line is using the concept improperly: it just gives the line number of the concept definition, not the usage.

See it live: https://godbolt.org/z/zYAGn_

Possibly related to #25.

davidstone avatar Jan 02 '20 19:01 davidstone

Can you double check with clang trunk? This seems to work now.

marehr avatar Feb 07 '20 23:02 marehr