Index: clang/lib/AST/Interp/ByteCodeExprGen.cpp =================================================================== --- clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -359,10 +359,15 @@ template bool ByteCodeExprGen::VisitImplicitValueInitExpr(const ImplicitValueInitExpr *E) { - if (Optional T = classify(E)) - return this->emitZero(*T, E); + Optional T = classify(E); - return false; + if (!T) + return false; + + if (E->getType()->isPointerType()) + return this->emitNullPtr(E); + + return this->emitZero(*T, E); } template Index: clang/test/AST/Interp/literals.cpp =================================================================== --- clang/test/AST/Interp/literals.cpp +++ clang/test/AST/Interp/literals.cpp @@ -49,7 +49,10 @@ static_assert(!nu, ""); }; - +constexpr int UninitI; // expected-error {{must be initialized by a constant expression}} \ + // ref-error {{must be initialized by a constant expression}} +constexpr int *UninitPtr; // expected-error {{must be initialized by a constant expression}} \ + // ref-error {{must be initialized by a constant expression}} constexpr bool getTrue() { return true; } constexpr bool getFalse() { return false; }