diff options
author | Douglas Gregor <dgregor@apple.com> | 2013-03-26 23:59:23 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2013-03-26 23:59:23 +0000 |
commit | defa32ef4fdc166d39d2d0859e5edbd78da2ddd0 (patch) | |
tree | 6d577d6302e8cda5e37593f2349f5e182f4654a4 /lib/Sema/SemaInit.cpp | |
parent | ddb61764abf07ea4580796752d87fda53378ba26 (diff) |
<rdar://problem/13278115> Improve diagnostic when failing to bind an rvalue reference to an lvalue of compatible type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178095 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaInit.cpp')
-rw-r--r-- | lib/Sema/SemaInit.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 8516422e4d..63309e376e 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -3518,6 +3518,14 @@ static void TryReferenceInitializationCore(Sema &S, return; } + if ((RefRelationship == Sema::Ref_Compatible || + RefRelationship == Sema::Ref_Compatible_With_Added_Qualification) && + isRValueRef && InitCategory.isLValue()) { + Sequence.SetFailed( + InitializationSequence::FK_RValueReferenceBindingToLValue); + return; + } + Sequence.SetFailed(InitializationSequence::FK_ReferenceInitDropsQualifiers); return; } |