aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGExprConstant.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard@metafoo.co.uk>2020-11-06 18:14:41 -0800
committerRichard Smith <richard@metafoo.co.uk>2020-12-18 01:08:41 -0800
commit9e08e51a20d0d2b1c5724bb17e969d036fced4cd (patch)
treeae857b5e73a4246e98e2ab189226e1414ef82412 /clang/lib/CodeGen/CGExprConstant.cpp
parent333d41e9eb8b5f6cd67d318e84ee8dba99b840cc (diff)
downloadllvm-9e08e51a20d0d2b1c5724bb17e969d036fced4cd.zip
llvm-9e08e51a20d0d2b1c5724bb17e969d036fced4cd.tar.gz
llvm-9e08e51a20d0d2b1c5724bb17e969d036fced4cd.tar.bz2
[c++20] P1907R1: Support for generalized non-type template arguments of scalar type.
Diffstat (limited to 'clang/lib/CodeGen/CGExprConstant.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprConstant.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp
index ca1d3a93..840541a 100644
--- a/clang/lib/CodeGen/CGExprConstant.cpp
+++ b/clang/lib/CodeGen/CGExprConstant.cpp
@@ -1366,11 +1366,11 @@ llvm::Constant *ConstantEmitter::tryEmitConstantExpr(const ConstantExpr *CE) {
if (!CE->hasAPValueResult())
return nullptr;
const Expr *Inner = CE->getSubExpr()->IgnoreImplicit();
- QualType RetType;
- if (auto *Call = dyn_cast<CallExpr>(Inner))
- RetType = Call->getCallReturnType(CGF->getContext());
- else if (auto *Ctor = dyn_cast<CXXConstructExpr>(Inner))
- RetType = Ctor->getType();
+ QualType RetType = Inner->getType();
+ if (Inner->isLValue())
+ RetType = CGF->getContext().getLValueReferenceType(RetType);
+ else if (Inner->isXValue())
+ RetType = CGF->getContext().getRValueReferenceType(RetType);
llvm::Constant *Res =
emitAbstract(CE->getBeginLoc(), CE->getAPValueResult(), RetType);
return Res;