-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Full name of submitter (unless configured in github; will be published with the issue): Jakub Jelinek
Reference (section label): stmt.expand
Link to reflector thread (if any):
Issue description:
I think the
https://eel.is/c++draft/stmt.expand#example-2
example is incorrect. The lowering of iterating expansion statement is supposed to add
static constexpr auto&& range = expansion-initializer;
which in the example case is
consteval int f() {
constexpr std::array<int, 3> arr {1, 2, 3};
int result = 0;
{
static constexpr auto&& range = arr;
...
and I think under the https://wg21.link/P2686R5 rules one can't refer to address of automatic variable or have a reference to that from static constexpr var. Are the 4 static keywords in the lowering of iterating expansion statements really needed (weren't they needed before P2686R5?
Suggested resolution:
If it is intentional that the 4 static keywords are there, then perhaps the example should add static keyword before
constexpr std::array<int, 3> arr {1, 2, 3};