summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-02-17 00:44:16 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-02-17 00:44:16 +0000
commit5d108606cc12cdc372fbba2d27285e0a57455bea (patch)
tree9c6dfb41cc112886e7331b254ec50a7e56d4c938 /clang/lib
parent5bade3dc6ed11b39f5ac460a33e65c80d7a44df1 (diff)
downloadbcm5719-llvm-5d108606cc12cdc372fbba2d27285e0a57455bea.tar.gz
bcm5719-llvm-5d108606cc12cdc372fbba2d27285e0a57455bea.zip
PR12012: Fix a regression in r150419 where we would try (and fail) to
zero-initialize class types with virtual bases when constant-evaluating an initializer. llvm-svn: 150770
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/ExprConstant.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 1a396e14254..0ef7111f978 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -3387,6 +3387,11 @@ bool RecordExprEvaluator::ZeroInitialization(const Expr *E) {
return EvaluateInPlace(Result.getUnionValue(), Info, Subobject, &VIE);
}
+ if (isa<CXXRecordDecl>(RD) && cast<CXXRecordDecl>(RD)->getNumVBases()) {
+ Info.Diag(E->getExprLoc(), diag::note_constexpr_virtual_base) << RD;
+ return false;
+ }
+
return HandleClassZeroInitialization(Info, E, RD, This, Result);
}
OpenPOWER on IntegriCloud