-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Full name of submitter (unless configured in github; will be published with the issue): Jakub Jelinek
Reference (section label): [basic.types.general]/12, [expr.const]
Link to reflector thread (if any):
Issue description:
Most of the places in the standard which refer to consteval-only types mention it as if it was a property of a type unchangeable during the whole translation unit, if something is of consteval-only type, then this or that.
As the definition of consteval-only type includes pointers/references to those, I'm afraid what is or isn't a consteval-only type can change during the parsing of a translation unit.
struct A;
struct B { A *p; constexpr B (A *x) : p (x) {} };
struct A { decltype (^^::) a = ^^::; };In between the struct B and struct A definition, B is not consteval-only type but after it it is consteval-only. If there is a variable definition with B type,shall it be treated as a variable with consteval-only type or not? If there is an immediate-escalating with a non-constexpr B variable inside of its body, shall it be escalared to immediate function?
Shouldn't the standard talk about consteval-only type at point P to make it clear what exactly it means?
Either some of the decisions on whether something has consteval-only type need to be deferred until the end of a translation unit (but say std::meta::is_consteval_only_type metafn/std::is_consteval_only need to be evaluated at the point of use, or whether something has consteval-only type needs to be remembered (say for a variable on its definition) and not changed afterwards even if a type later on becomes consteval-only. Or the definition of consteval-only type should be changed, so that for a class definition (or template instantiation point) whether any non-static data members had consteval-only type or not matters at the point of that definition/instantiation and doesn't change later on. So, for class types the implementations would then remember whether it is a consteval-only type or not and that wouldn't change later on. Even in that case
struct A;
A *p;
struct A { decltype (^^::) a = ^^::; };whether some pointer/function type could change later on.