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 | 9f8400eca4a24b0b72d2ed5efeecda215edd2a8c (patch) | |
| tree | 864e9078d5c329f2b13f82f6fa9b349d62b9a801 /clang/lib/Sema/SemaExpr.cpp | |
| parent | dc16628c93a52ff342ea3969e38f994226783b25 (diff) | |
| download | bcm5719-llvm-9f8400eca4a24b0b72d2ed5efeecda215edd2a8c.tar.gz bcm5719-llvm-9f8400eca4a24b0b72d2ed5efeecda215edd2a8c.zip | |
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.
llvm-svn: 180866
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 173ee1e7f81..9f4f6d051c8 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/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) { |

