diff options
-rw-r--r-- | lib/CodeGen/CGCXXExpr.cpp | 2 | ||||
-rw-r--r-- | test/CodeGenCXX/delete.cpp | 12 |
2 files changed, 14 insertions, 0 deletions
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<PointerType>()->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 <typename T> +class A { + operator T *() const; +}; + +void f() { + A<char*> a; + + delete a; +} |