diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-10-01 05:49:51 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-10-01 05:49:51 +0000 |
commit | d69dd780866d8478516153870e8c3491c6eaa156 (patch) | |
tree | 0c45d8c86b9bb226c7e9e48ba03b03b39fb3995d | |
parent | 85e2db72137c28114d3981c044946a8c16ef6011 (diff) |
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
-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; +} |