diff options
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r-- | clang/lib/AST/Expr.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 77d444151c3..72e1119851b 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -1885,6 +1885,11 @@ ImplicitCastExpr *ImplicitCastExpr::Create(const ASTContext &C, QualType T, ExprValueKind VK) { unsigned PathSize = (BasePath ? BasePath->size() : 0); void *Buffer = C.Allocate(totalSizeToAlloc<CXXBaseSpecifier *>(PathSize)); + // Per C++ [conv.lval]p3, lvalue-to-rvalue conversions on class and + // std::nullptr_t have special semantics not captured by CK_LValueToRValue. + assert((Kind != CK_LValueToRValue || + !(T->isNullPtrType() || T->getAsCXXRecordDecl())) && + "invalid type for lvalue-to-rvalue conversion"); ImplicitCastExpr *E = new (Buffer) ImplicitCastExpr(T, Kind, Operand, PathSize, VK); if (PathSize) |