diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-04-29 08:24:44 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-04-29 08:24:44 +0000 |
| commit | db05f1fb08470fbc5de0c033f4be7ceb0dd3c882 (patch) | |
| tree | 3285f87de8c69151ce74d38778a68b72833d4347 /clang/lib/Sema | |
| parent | 4f402bd9853630b3cd15a68fba1de2cb9d74c236 (diff) | |
| download | bcm5719-llvm-db05f1fb08470fbc5de0c033f4be7ceb0dd3c882.tar.gz bcm5719-llvm-db05f1fb08470fbc5de0c033f4be7ceb0dd3c882.zip | |
PR9546, DR1268: A prvalue cannot be reinterpret_cast to an rvalue reference
type. But a glvalue can be reinterpret_cast to either flavor of reference.
llvm-svn: 155789
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaCast.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaCast.cpp b/clang/lib/Sema/SemaCast.cpp index 54683e127ec..a67d1dec59e 100644 --- a/clang/lib/Sema/SemaCast.cpp +++ b/clang/lib/Sema/SemaCast.cpp @@ -1504,10 +1504,9 @@ static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr, } if (const ReferenceType *DestTypeTmp = DestType->getAs<ReferenceType>()) { - bool LValue = DestTypeTmp->isLValueReferenceType(); - if (LValue && !SrcExpr.get()->isLValue()) { - // Cannot cast non-lvalue to lvalue reference type. See the similar - // comment in const_cast. + if (!SrcExpr.get()->isGLValue()) { + // Cannot cast non-glvalue to (lvalue or rvalue) reference type. See the + // similar comment in const_cast. msg = diag::err_bad_cxx_cast_rvalue; return TC_NotApplicable; } |

