Index: lib/CodeGen/CGDecl.cpp =================================================================== --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -571,6 +571,8 @@ Qualifiers::ObjCLifetime lifetime = lvalue.getObjCLifetime(); if (!lifetime) { llvm::Value *value = EmitScalarExpr(init); + if (!value) + return; if (capturedByInit) drillIntoBlockVariable(*this, lvalue, cast(D)); EmitStoreThroughLValue(RValue::get(value), lvalue, true); Index: lib/CodeGen/CGExprScalar.cpp =================================================================== --- lib/CodeGen/CGExprScalar.cpp +++ lib/CodeGen/CGExprScalar.cpp @@ -349,6 +349,8 @@ } Value *VisitCXXDefaultInitExpr(CXXDefaultInitExpr *DIE) { CodeGenFunction::CXXDefaultInitExprScope Scope(CGF); + if(!DIE->getExpr()) + return 0; return Visit(DIE->getExpr()); } Value *VisitCXXThisExpr(CXXThisExpr *TE) { Index: test/CodeGenCXX/pr19195.cpp =================================================================== --- test/CodeGenCXX/pr19195.cpp +++ test/CodeGenCXX/pr19195.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -std=c++11 -emit-llvm-only %s -o %t +/* Testcase for PR19195 - clang hits assert during in class initialization */ + +class Cls { + Cls(); + template struct Templ { + Templ() {} + int initialized_member = 0; + }; + Templ trigger_instantiation; +}; +Cls::Cls() {}