[PATCH] D151515: [Sema] add cast from IncompleteArrayType to ConstantArrayType in TryReferenceListInitialization
Congcong Cai via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 30 12:43:40 PDT 2023
HerrCai0907 added inline comments.
================
Comment at: clang/lib/Sema/SemaInit.cpp:4433
+ // where H is the initializer list.
+ Sequence.AddQualificationConversionStep(cv1T1, VK_XValue);
+ }
----------------
erichkeane wrote:
> Is `VK_XValue` correct here? The standards quote says it is a PRValue?
The original text of standards in https://eel.is/c++draft/dcl.init.list is
> List-initialization of an object or reference of type T is defined as follows:
> 3.10 Otherwise, if T is a reference type, a prvalue is generated. The prvalue initializes its result object by copy-list-initialization from the initializer list. The prvalue is then used to direct-initialize the reference. The type of the prvalue is the type referenced by T, unless T is “reference to array of unknown bound of U”, in which case the type of the prvalue is the type of x in the declaration U x[] H, where H is the initializer list.
My understand is that a PRValue is generated by XValue initialization list.
By the way, I have try to use VK_PRValue, it cause the assert failed:
can't implicitly cast glvalue to prvalue with this cast kind: NoOp
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151515/new/
https://reviews.llvm.org/D151515
More information about the cfe-commits
mailing list