diff options
author | Richard Smith <richard@metafoo.co.uk> | 2021-01-08 15:17:54 -0800 |
---|---|---|
committer | Richard Smith <richard@metafoo.co.uk> | 2021-01-08 15:19:28 -0800 |
commit | 2bf6e443e54604c7818c4d1a1837f3d091023270 (patch) | |
tree | c4804f26921697840aef1a40df74398ecec68103 /clang/lib/Sema/SemaInit.cpp | |
parent | e05baf40de8a3bbfcf4a765761b1147e94b7309c (diff) | |
download | llvm-2bf6e443e54604c7818c4d1a1837f3d091023270.zip llvm-2bf6e443e54604c7818c4d1a1837f3d091023270.tar.gz llvm-2bf6e443e54604c7818c4d1a1837f3d091023270.tar.bz2 |
Attempt to complete an incomplete expression type when considering a
reference binding to an expression.
We need to know the array bound in order to determine whether the
parameter type is reference-compatible with the argument type, so we
need to trigger instantiation in this case.
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r-- | clang/lib/Sema/SemaInit.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index 38f6a59..f4493d8 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -4264,7 +4264,7 @@ static void TryReferenceListInitialization(Sema &S, // bind to that. if (InitList->getNumInits() == 1) { Expr *Initializer = InitList->getInit(0); - QualType cv2T2 = Initializer->getType(); + QualType cv2T2 = S.getCompletedType(Initializer); Qualifiers T2Quals; QualType T2 = S.Context.getUnqualifiedArrayType(cv2T2, T2Quals); @@ -4700,7 +4700,7 @@ static void TryReferenceInitialization(Sema &S, QualType cv1T1 = DestType->castAs<ReferenceType>()->getPointeeType(); Qualifiers T1Quals; QualType T1 = S.Context.getUnqualifiedArrayType(cv1T1, T1Quals); - QualType cv2T2 = Initializer->getType(); + QualType cv2T2 = S.getCompletedType(Initializer); Qualifiers T2Quals; QualType T2 = S.Context.getUnqualifiedArrayType(cv2T2, T2Quals); |