Skip to content

Commit 4cff8f0

Browse files
skip calling into ConstExprEmitter for reference type destinations instead
1 parent 52e5c10 commit 4cff8f0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

clang/lib/CodeGen/CGExprConstant.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,8 +1359,6 @@ class ConstExprEmitter :
13591359
}
13601360

13611361
llvm::Constant *VisitStringLiteral(StringLiteral *E, QualType T) {
1362-
if (!isa<ConstantArrayType>(T.getDesugaredType(CGM.getContext())))
1363-
return nullptr;
13641362
// This is a string literal initializing an array in an initializer.
13651363
return CGM.GetConstantArrayFromStringLiteral(E);
13661364
}
@@ -1778,9 +1776,10 @@ llvm::Constant *ConstantEmitter::tryEmitPrivate(const Expr *E,
17781776
QualType destType) {
17791777
assert(!destType->isVoidType() && "can't emit a void constant");
17801778

1781-
if (llvm::Constant *C =
1782-
ConstExprEmitter(*this).Visit(const_cast<Expr *>(E), destType))
1783-
return C;
1779+
if (!destType->isReferenceType())
1780+
if (llvm::Constant *C =
1781+
ConstExprEmitter(*this).Visit(const_cast<Expr *>(E), destType))
1782+
return C;
17841783

17851784
Expr::EvalResult Result;
17861785

0 commit comments

Comments
 (0)