diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-05-01 19:00:39 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-05-01 19:00:39 +0000 |
commit | a07a6c3e756d0a6a5baa2cad9d165f79f0fb1b42 (patch) | |
tree | 86ae2534898f642795d144c01eb95e31b9b868eb /lib/Sema | |
parent | 112344ab7f96cf482bce80530676712c282756d5 (diff) |
PR15884: In the 'taking the address of a temporary' extension, materialize the
temporary to an lvalue before taking its address. This removes a weird special
case from the AST representation, and allows the constant expression evaluator
to deal with it without (broken) hacks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180866 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 173ee1e7f8..9f4f6d051c 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -8306,6 +8306,9 @@ static QualType CheckAddressOfOperand(Sema &S, ExprResult &OrigOp, << op->getType() << op->getSourceRange(); if (sfinae) return QualType(); + // Materialize the temporary as an lvalue so that we can take its address. + OrigOp = op = new (S.Context) + MaterializeTemporaryExpr(op->getType(), OrigOp.take(), true); } else if (isa<ObjCSelectorExpr>(op)) { return S.Context.getPointerType(op->getType()); } else if (lval == Expr::LV_MemberFunction) { |