diff options
author | David Majnemer <david.majnemer@gmail.com> | 2014-12-14 08:40:47 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2014-12-14 08:40:47 +0000 |
commit | 8c92b87cd0c34c68f1025f39405e7b783074430b (patch) | |
tree | e69ee98a0423cdb27a867d392578be9339cab4ba /clang/lib/AST/ExprConstant.cpp | |
parent | 0b23c37413ce435929cc7f6ddf202c103a7c91e0 (diff) | |
download | bcm5719-llvm-8c92b87cd0c34c68f1025f39405e7b783074430b.tar.gz bcm5719-llvm-8c92b87cd0c34c68f1025f39405e7b783074430b.zip |
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
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 417f7931df4..ad36e76bea4 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -1426,7 +1426,9 @@ static bool isZeroSized(const LValue &Value) { 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; } |