https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67240
Bug ID: 67240
Summary: [concepts] Implicit conversion constraints are not
respected
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: sebi707 at gmail dot com
Target Milestone: ---
Using the trailing return type to add constraints does not work in some cases.
The following code should not compile:
int foo(int x)
{
return x;
}
template <typename T>
concept bool C1 = requires (T x) {
{foo(x)} -> int&;
};
template <typename T>
concept bool C2 = requires (T x) {
{foo(x)} -> void;
};
static_assert( C1<int> );
static_assert( C2<int> );
However this compiles just fine with r226884.