https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103714
Bug ID: 103714
Summary: [11/12 Regression] name lookup in requires-clause
finds wrong thing
Product: gcc
Version: 11.2.1
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
CC: ppalka at gcc dot gnu.org
Target Milestone: ---
This invalid code started to be accepted at r11-8144
template <int I>
struct derp
{
constexpr inline static int i = I;
template <int J>
void f(derp<J> d) requires(d.i < i)
{
__builtin_printf("derp %zu < %zu\n", d.i, i);
derp<I> d2;
f(d2);
}
};
int main()
{
derp<9> d9;
derp<8> d8;
d9.f(d8);
}
If the requires clause is changed to (d.derp<J>::i < i) then it is correctly
rejected, but for some reason (d.i < i) is satisfied.