Strip cv-qualifiers when building C++ constructor and destructor
names.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102171 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/AST/DeclarationName.h b/include/clang/AST/DeclarationName.h
index a02e8d9..9401786 100644
--- a/include/clang/AST/DeclarationName.h
+++ b/include/clang/AST/DeclarationName.h
@@ -334,13 +334,15 @@
   /// getCXXConstructorName - Returns the name of a C++ constructor
   /// for the given Type.
   DeclarationName getCXXConstructorName(CanQualType Ty) {
-    return getCXXSpecialName(DeclarationName::CXXConstructorName, Ty);
+    return getCXXSpecialName(DeclarationName::CXXConstructorName, 
+                             Ty.getUnqualifiedType());
   }
 
   /// getCXXDestructorName - Returns the name of a C++ destructor
   /// for the given Type.
   DeclarationName getCXXDestructorName(CanQualType Ty) {
-    return getCXXSpecialName(DeclarationName::CXXDestructorName, Ty);
+    return getCXXSpecialName(DeclarationName::CXXDestructorName, 
+                             Ty.getUnqualifiedType());
   }
 
   /// getCXXConversionFunctionName - Returns the name of a C++
diff --git a/test/SemaTemplate/destructor-template.cpp b/test/SemaTemplate/destructor-template.cpp
index 83b1bee..fa1b3e0 100644
--- a/test/SemaTemplate/destructor-template.cpp
+++ b/test/SemaTemplate/destructor-template.cpp
@@ -32,3 +32,11 @@
   template struct X<int>;
 }
 
+namespace cvquals {
+  template<typename T>
+  void f(int *ptr) {
+    ptr->~T();
+  }
+
+  template void f<const volatile int>(int *);
+}