AST: Limit zero-sized constexpr behavior to array types
Restricting this "extension" to array types maximizes our standards
conformance while not miscompiling real-world programs.
llvm-svn: 224215
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 417f793..ad36e76 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -1426,7 +1426,9 @@
const ValueDecl *Decl = GetLValueBaseDecl(Value);
if (Decl && isa<VarDecl>(Decl)) {
QualType Ty = Decl->getType();
- return Ty->isIncompleteType() || Decl->getASTContext().getTypeSize(Ty) == 0;
+ if (Ty->isArrayType())
+ return Ty->isIncompleteType() ||
+ Decl->getASTContext().getTypeSize(Ty) == 0;
}
return false;
}