diff options
author | Anastasia Stulova <anastasia.stulova@arm.com> | 2019-06-20 16:23:28 +0000 |
---|---|---|
committer | Anastasia Stulova <anastasia.stulova@arm.com> | 2019-06-20 16:23:28 +0000 |
commit | c25ea86d43929c02dcc19512fb26a99ca256657d (patch) | |
tree | 0ad87beb7adde675054e9fa58282c99d0a0cfcc2 /clang/lib/Sema/SemaInit.cpp | |
parent | 1fffe8d6eede5afedb6da94443229657df724d22 (diff) | |
download | bcm5719-llvm-c25ea86d43929c02dcc19512fb26a99ca256657d.tar.gz bcm5719-llvm-c25ea86d43929c02dcc19512fb26a99ca256657d.zip |
[Sema] Diagnose addr space mismatch while constructing objects
If we construct an object in some arbitrary non-default addr space
it should fail unless either:
- There is an implicit conversion from the address space to default
/generic address space.
- There is a matching ctor qualified with an address space that is
either exactly matching or convertible to the address space of an
object.
Differential Revision: https://reviews.llvm.org/D62156
llvm-svn: 363944
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r-- | clang/lib/Sema/SemaInit.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index d5ef5eddf3e..16c396890a9 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -3733,6 +3733,7 @@ ResolveConstructorOverload(Sema &S, SourceLocation DeclLoc, bool OnlyListConstructors, bool IsListInit, bool SecondStepOfCopyInit = false) { CandidateSet.clear(OverloadCandidateSet::CSK_InitByConstructor); + CandidateSet.setDestAS(DestType.getQualifiers().getAddressSpace()); for (NamedDecl *D : Ctors) { auto Info = getConstructorInfo(D); @@ -4985,6 +4986,7 @@ static void TryUserDefinedConversion(Sema &S, // structure, so that it will persist if we fail. OverloadCandidateSet &CandidateSet = Sequence.getFailedCandidateSet(); CandidateSet.clear(OverloadCandidateSet::CSK_InitByUserDefinedConversion); + CandidateSet.setDestAS(DestType.getQualifiers().getAddressSpace()); // Determine whether we are allowed to call explicit constructors or // explicit conversion operators. |