[Bug c++/94332] New: [concepts] requires-expression that contains a requires-expression incorrectly evaluates to false
ppalka at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Mar 25 17:06:51 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94332
Bug ID: 94332
Summary: [concepts] requires-expression that contains a
requires-expression incorrectly evaluates to false
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ppalka at gcc dot gnu.org
Target Milestone: ---
$ cat requires-requires.C
template<bool B>
requires B
struct X { };
template<typename T>
concept C = requires { X<requires { true; }>{}; };
static_assert(C<int>); // should succeed
$ g++ -std=c++2a requires-requires.C
requires-requires.C:8:15: error: static assertion failed
8 | static_assert(C<int>); // should succeed
| ^~~~~~
requires-requires.C:8:15: note: constraints not satisfied
requires-requires.C:6:11: required by the constraints of ‘template<class T>
concept C’
requires-requires.C:6:15: in requirements
requires-requires.C:6:26: note: the required expression ‘X<requires{true;}>{}’
is invalid
6 | concept C = requires { X<requires { true; }>{}; };
| ^~~~~~~~~~~~~~~~~~~~~~~
If we let the compiler elaborate further, we get:
requires-requires.C:6:26: note: the required expression ‘X<requires{true;}>{}’
is invalid, because
6 | concept C = requires { X<requires { true; }>{}; };
| ^~~~~~~~~~~~~~~~~~~~~~~
requires-requires.C:6:26: error: invalid use of incomplete type ‘struct
X<requires{true;}>’
requires-requires.C:3:10: note: declaration of ‘struct X<requires{true;}>’
3 | struct X { };
More information about the Gcc-bugs
mailing list