diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-17 00:44:16 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-17 00:44:16 +0000 |
| commit | 5d108606cc12cdc372fbba2d27285e0a57455bea (patch) | |
| tree | 9c6dfb41cc112886e7331b254ec50a7e56d4c938 /clang/lib | |
| parent | 5bade3dc6ed11b39f5ac460a33e65c80d7a44df1 (diff) | |
| download | bcm5719-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.cpp | 5 |
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); } |

