-
Notifications
You must be signed in to change notification settings - Fork 803
Description
https://eel.is/c++draft/expr.const#example-16
struct S6;
consteval { // #1
struct S7; // local class
std::meta::define_aggregate(^^S7, {}); // error: consteval block #1 does not enclose itself,
// but encloses S7
consteval { // #2
std::meta::define_aggregate(^^S6, {}); // error: consteval block #1 encloses
// consteval block #2 but not S6
std::meta::define_aggregate(^^S7, {}); // OK, consteval block #1 encloses both #2 and S7
}
}I think it would be better to add struct S8; below struct S7; and use S8 instead of S7 on the last define_aggregate line.
The problem is that the inner consteval block is evaluated first and successfully defines S7 to be complete with no non-static data members,
and only then is the first std::meta::define_aggregate(^^S7, {}); evaluated. And so it doesn't have just the error that it would create an injected declaration violating https://eel.is/c++draft/expr.const#31.2 but it also violates https://eel.is/c++draft/meta.reflection#define.aggregate-8.1
So, I think it would be better to show in the example something that has only one of the errors, not two where the latter one will cause no injected declaration being attempted at all.