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
[dcl.constexpr] p6 Relax the condition for a constexpr function that could be well-formed #5426
Comments
For clarity on what the "does not exist" refers to, I think we want to retain the reference to "argument values". Maybe "A valid invocation is a set of argument values for which an invocation of a constexpr function or constructor ... If no valid invocation exists for a constexpr function or constexpr constructor that is neither defaulted nor a template, the program is ill-formed, no diagnostic required." |
As exposed in the first example(i.e. the non-member function), the function does not have a parameter and therefore the function call does not have arguments. It could be argued that the member function can have the implicit object argument, however, the non-member function definitely does not have arguments. |
Shall we phrase the wording as:
|
"set of argument values" does convey "possibly none", in my view. We can add "if any", if that helps. I wouldn't want to define a global defined term for a concept that is only used in the next sentence and nowhere else. Oh, and it's not really "potentially constant", since the set of argument values you found actually makes the invocation a core constant expression. |
@jensmaurer All right. Could we add "implied object argument" in that sentence, I think it also helps when we encounter member functions whose parameter-declaration-clause is empty. Because we define the concept in [dcl.fct]
The implied object argument is only mentioned in clause [over]. I think the second case strongly implies the argument should consider the implied object argument. |
Hm. Isn't this issue a subject of http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2448r2.html#pnum_24? |
[dcl.constexpr] p6 says
The condition here requires an argument to make the rule true. Consider this example:
No argument here, however, the example is accepted by implementations. I think the argument is not necessary here to make the rule true. Maybe, we just need to say
In the above example, there exists such an invocation(e.g. v!=1,
a!=1
). As a contract example:Since
B
is not a literal type and cannot be used to create aconstexpr
object or temporary object of the type within the context of a core constant expression, thus the lvalue-to-rvalue conversion that is applied toa
can never satisfy the requirement of a core constant expression.The text was updated successfully, but these errors were encountered: