This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/84810] New: [concepts][c++20] constraints of lambdas with explicit template parameters are not checked
- From: "eric.niebler at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 10 Mar 2018 19:45:25 +0000
- Subject: [Bug c++/84810] New: [concepts][c++20] constraints of lambdas with explicit template parameters are not checked
- Auto-submitted: auto-generated
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`.