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
[expr.new] doesn't specify the type of a new-expression #4752
Comments
For single-object new-expression, the relevant rule is defined as that
While the relevant rule for array new-expression is defined as that
|
This specifies the value of a new-expression. http://eel.is/c++draft/basic.lval#def:result,prvalue http://eel.is/c++draft/basic.compound#def:pointer_to |
For the type of a value "pointer to an object", it is specified in [basic.compound#3], which is
the value that is a pointer to the object of T certainly has the type "pointer to T" For the case of the initial element of an array, the element(subobject) has the type But, [basic.compound#3] actually didn't define what "function pointer type" is, which could be clarified with a fix to #4712. |
int i;
reinterpret_cast<unsigned*>(&i); // value «pointer to an object of type int» has type `unsigned*` |
I agree on this utterance is a bit reckless. |
[Note 6: Both
new int
andnew int[10]
have typeint*
and the type ofnew int[i][10]
isint (*)[10]
— end note]I couldn't find normative wording in [expr.new] supporting this. Is it somewhere else?
The text was updated successfully, but these errors were encountered: