summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaInit.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2013-03-26 23:59:23 +0000
committerDouglas Gregor <dgregor@apple.com>2013-03-26 23:59:23 +0000
commit6fa6ab0675ddfd359086c2a6347f70f1f08f6a72 (patch)
tree2be40cd96f6d79bb4f54ec08e6604b2c90fdab06 /clang/lib/Sema/SemaInit.cpp
parentfb0a6329bdf82dfa87fe17a476388e385f393a78 (diff)
downloadbcm5719-llvm-6fa6ab0675ddfd359086c2a6347f70f1f08f6a72.tar.gz
bcm5719-llvm-6fa6ab0675ddfd359086c2a6347f70f1f08f6a72.zip
<rdar://problem/13278115> Improve diagnostic when failing to bind an rvalue reference to an lvalue of compatible type.
llvm-svn: 178095
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r--clang/lib/Sema/SemaInit.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 8516422e4df..63309e376ea 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/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;
}
OpenPOWER on IntegriCloud