diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-09-01 02:09:07 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-09-01 02:09:07 +0000 |
commit | 528499bb44e2229709d3bc6a04c8700c083e65d0 (patch) | |
tree | 1544912d657b5ac0d21a3678e60d17ff7ebbc041 /clang/lib/Sema/SemaDeclCXX.cpp | |
parent | 90da66bb6935c9733a6a45c3ddd705a8382427c2 (diff) | |
download | bcm5719-llvm-528499bb44e2229709d3bc6a04c8700c083e65d0.tar.gz bcm5719-llvm-528499bb44e2229709d3bc6a04c8700c083e65d0.zip |
When defining the implicit move assignment operator, don't perform
semantic analysis when taking the address of an xvalue. Instead, just
build the unary operator directly, since it's safe to do so (from the
IRgen and AST perspectives) for any glvalue. Fixes PR10822.
llvm-svn: 138935
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index df0a5226c0f..91895f0687a 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -7901,9 +7901,15 @@ void Sema::DefineImplicitMoveAssignment(SourceLocation CurrentLocation, Size *= ArraySize; } - // Take the address of the field references for "from" and "to". - From = CreateBuiltinUnaryOp(Loc, UO_AddrOf, From.get()); - To = CreateBuiltinUnaryOp(Loc, UO_AddrOf, To.get()); + // Take the address of the field references for "from" and "to". We + // directly construct UnaryOperators here because semantic analysis + // does not permit us to take the address of an xvalue. + From = new (Context) UnaryOperator(From.get(), UO_AddrOf, + Context.getPointerType(From.get()->getType()), + VK_RValue, OK_Ordinary, Loc); + To = new (Context) UnaryOperator(To.get(), UO_AddrOf, + Context.getPointerType(To.get()->getType()), + VK_RValue, OK_Ordinary, Loc); bool NeedsCollectableMemCpy = (BaseType->isRecordType() && |