[Bug c++/94186] New: compiler incorrectly accepts a requires clause with predicate of non-bool type
akrzemi1 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Mar 15 22:43:51 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94186
Bug ID: 94186
Summary: compiler incorrectly accepts a requires clause with
predicate of non-bool type
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: akrzemi1 at gmail dot com
Target Milestone: ---
The following program should fail to compile in C++20 because the type of the
predicate in requires-clause is not bool.
```
template <typename T>
struct is_small
{
enum { value = sizeof(T) <= 4 };
};
template <typename T>
requires is_small<T>::value
void fun(T) {}
template <typename T>
void fun(T) {}
int main()
{
fun(1); // expected hard compiler error
}
```
More information about the Gcc-bugs
mailing list