[Bug c++/84810] New: [concepts][c++20] constraints of lambdas with explicit template parameters are not checked
eric.niebler at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Mar 10 19:45:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84810
Bug ID: 84810
Summary: [concepts][c++20] constraints of lambdas with explicit
template parameters are not checked
Product: gcc
Version: 8.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: eric.niebler at gmail dot com
Target Milestone: ---
The following code declares a C++20 lambda with a constraint. The invocation of
the lambda should be ill-formed unless the constraint is satisfied; however,
gcc is accepting invalid code.
template <class> constexpr bool is_int = false;
template <> constexpr bool is_int<int> = true;
template <class T>
concept bool Int = is_int<T>;
int main() {
auto x = []<Int T>(T t) { return 42; };
auto y = x(42);
auto z = x(""); // should be ill-formed.
return z;
}
Compile with gcc trunk and `-fconcepts -std=gnu++2a`.
More information about the Gcc-bugs
mailing list