From: Douglas Gregor Date: Thu, 1 Oct 2009 05:49:51 +0000 (+0000) Subject: Fix a lame regression in IR gen for C++ delete expressions. PR5102 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d69dd780866d8478516153870e8c3491c6eaa156;p=clang Fix a lame regression in IR gen for C++ delete expressions. PR5102 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83195 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGCXXExpr.cpp b/lib/CodeGen/CGCXXExpr.cpp index 7dd6427752..2d62df6c58 100644 --- a/lib/CodeGen/CGCXXExpr.cpp +++ b/lib/CodeGen/CGCXXExpr.cpp @@ -246,6 +246,8 @@ void CodeGenFunction::EmitCXXDeleteExpr(const CXXDeleteExpr *E) { if (ICE->getCastKind() != CastExpr::CK_UserDefinedConversion && ICE->getType()->isVoidPointerType()) Arg = ICE->getSubExpr(); + else + break; } QualType DeleteTy = Arg->getType()->getAs()->getPointeeType(); diff --git a/test/CodeGenCXX/delete.cpp b/test/CodeGenCXX/delete.cpp index 8367dd8945..9e3feefefe 100644 --- a/test/CodeGenCXX/delete.cpp +++ b/test/CodeGenCXX/delete.cpp @@ -23,3 +23,15 @@ void t4(T *t) { // RUN: grep "call void @_ZN1TD1Ev" %t | count 1 delete t; } + +// PR5102 +template +class A { + operator T *() const; +}; + +void f() { + A a; + + delete a; +}