Index: lib/CodeGen/CGExpr.cpp =================================================================== --- lib/CodeGen/CGExpr.cpp +++ lib/CodeGen/CGExpr.cpp @@ -799,6 +799,10 @@ if (E->getType()->isVariablyModifiedType()) EmitVariablyModifiedType(E->getType()); + if (isa(CE)) + if (CGDebugInfo *DI = getDebugInfo()) + DI->EmitExplicitCastType(E->getType()); + switch (CE->getCastKind()) { // Non-converting casts (but not C's implicit conversion from void*). case CK_BitCast: Index: test/CodeGenCXX/debug-info-explicit-cast.cpp =================================================================== --- test/CodeGenCXX/debug-info-explicit-cast.cpp +++ test/CodeGenCXX/debug-info-explicit-cast.cpp @@ -0,0 +1,18 @@ +// RUN: %clangxx -c -target x86_64-unknown-unknown -g %s -emit-llvm -S -o - | FileCheck %s +struct Foo { + int a; + Foo() : a(1){}; +}; + +struct Bar { + int b; + Bar() : b(2){}; +}; + +int main() { + Bar *pb = new Bar; + + return reinterpret_cast(pb)->a; +} + +// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Foo",