Implement semantic analysis for C++ [expr.new]p18-20, which describe
how we find the operator delete that matches withe operator new we
found in a C++ new-expression.

This will also need CodeGen support. On a happy note, we're now a
"nans" away from building tramp3d-v4.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97209 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp
index 8d2a379..73cba1d 100644
--- a/lib/AST/DeclCXX.cpp
+++ b/lib/AST/DeclCXX.cpp
@@ -573,7 +573,13 @@
   if (getOverloadedOperator() != OO_Delete &&
       getOverloadedOperator() != OO_Array_Delete)
     return false;
-  
+
+  // C++ [basic.stc.dynamic.deallocation]p2:
+  //   A template instance is never a usual deallocation function,
+  //   regardless of its signature.
+  if (getPrimaryTemplate())
+    return false;
+
   // C++ [basic.stc.dynamic.deallocation]p2:
   //   If a class T has a member deallocation function named operator delete 
   //   with exactly one parameter, then that function is a usual (non-placement)