New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[basic.link] p19 Two confusing comments in the formal example #4925
Comments
For |
@opensdh , any opinion here? |
It is the declaration of the closure type of [basic.pre]/3 is wrong: values and objects aren't entities. [basic.link]/14 (after the bullets) doesn't really mean to distinguish "value" and "object"; we just use the term "initialize x to a value y" to mean "initialize the object associated with x to have the state y", where "state" refers to the value of a scalar or the collection of values for an object. (We should clean up "value"/"object" while (or shortly after) we're cleaning up "object"/"variable".) |
@opensdh Based on your interpretation, the second bullet of [basic.link#16.2] can be phrased to that
Such a rearranged structure seems to be clearer. For the case
However, the declaration of |
If we're going to change /16.2, we should actually fix the "usable in constant expressions" bit to not pertain to functions. How does the closure type (or its |
This is the question itself. In [expr.prim.lambda.closure] p3
It is the complete story about the Consider the declaration of closure type as the following struct UniqueClosure{ // declaration of the closure type
auto operator()();
};
auto UniqueClosure::operator()(){
f();
}
None of these bullets prove that the declaration of |
Per [basic.link#16.2]
s
is not usable in constant expressions and it satisfies no bullet in the [basic.link] p15, hences
is a non-TU-local entity, what does the value mean? Why do we say the value ofs
is TU-local?wrap
is defined as a constexpr variable but is not initialized to a TU-local value, hence it is not an exposure as per [basic.link] p15, as well as it is a non-TU-local object. What does the value mean? Why do we say the value ofwrap
is not TU-local?For
int y = ([]{f();}(),0);
, why do we say the declaration is an error? According to [basic.link#14.2], the declaration ofy
is not an exposure even though it is a non-TU-local entity, It didn't violate [basic.link#17].Consider [basic.link] p14
According to [basic.pre] p3 and [basic.link] p16,
value
andobject
are different entities, does it mean a variable defined as constexpr that is initialized with a TU-local object is not an exposure?The text was updated successfully, but these errors were encountered: