Full name of submitter (unless configured in github; will be published with the issue): Hubert Tong
Reference (section label): basic.def.odr
Link to reflector thread (if any): N/A
Issue description:
Consider
bool f() {
constexpr int z = 42;
return requires {
sizeof(int [*&z]);
} && requires (int x) {
sizeof(int [*&z]);
};
}
According to https://wg21.link/basic.scope.param, a function parameter scope is produced for the second requires-expression.
This means that, under https://wg21.link/basic.def.odr#10, there is an intervening function parameter scope that prevents z from being odr-usable in the context where it is named in the second requires-expression. There does not appear to be a good reason for the two requires-expressions to behave differently.
Suggested resolution:
Insert in https://eel.is/c++draft/basic.def.odr#10.2.2:
- the intervening scope is the function parameter scope of a requires-expression or a lambda-expression [...]