Mangle dependent template names such as the nested-name-specifier in

  T::apply <U>::type

Fixes PR6899, although I want to dig a little deeper into the FIXME
for dependent template names that refer to operators.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102167 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenCXX/mangle-template.cpp b/test/CodeGenCXX/mangle-template.cpp
index 22949da..8b097ff 100644
--- a/test/CodeGenCXX/mangle-template.cpp
+++ b/test/CodeGenCXX/mangle-template.cpp
@@ -104,3 +104,26 @@
   // CHECK: define weak_odr void @_ZN5test81fIiEEvNS_5int_cIXsrNS_4metaIT_E4typeE5valueEEE
   template void f<int>(int_c<sizeof(int)>);
 }
+
+namespace test9 {
+  template<typename T>
+  struct supermeta {
+    template<typename U>
+    struct apply {
+      typedef T U::*type;
+    };
+  };
+
+  struct X { };
+
+  template<typename T, typename U>
+  typename supermeta<T>::template apply<U>::type f();
+
+  void test_f() {
+    // CHECK: @_ZN5test91fIiNS_1XEEENS_9supermetaIT_E5applyIT0_E4typeEv()
+    // Note: GCC incorrectly mangles this as
+    // _ZN5test91fIiNS_1XEEENS_9supermetaIT_E5apply4typeEv, while EDG
+    // gets it right.
+    f<int, X>();
+  }
+}