[flang-commits] [flang] [Sema] add cast from IncompleteArrayType to ConstantArrayType in TryReferenceListInitialization (PR #65918)
Congcong Cai via flang-commits
flang-commits at lists.llvm.org
Mon Sep 18 07:24:34 PDT 2023
================
@@ -4532,6 +4532,15 @@ static void TryReferenceListInitialization(Sema &S,
if (T1Quals.hasAddressSpace())
Sequence.AddQualificationConversionStep(
cv1T1, DestType->isRValueReferenceType() ? VK_XValue : VK_LValue);
+ else if (S.getLangOpts().CPlusPlus20 &&
+ isa<IncompleteArrayType>(T1->getUnqualifiedDesugaredType()) &&
+ DestType->isRValueReferenceType()) {
+ // [dcl.init.list] p3.10
+ // 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.
+ Sequence.AddQualificationConversionStep(cv1T1, VK_XValue);
----------------
HerrCai0907 wrote:
Yes, int[1] to int[] in above example
https://github.com/llvm/llvm-project/pull/65918
More information about the flang-commits
mailing list