1 // RUN: %clang_cc1 -fms-extensions -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fms-extensions -fdelayed-template-parsing -fsyntax-only -verify %s
3 
4 // expected-no-diagnostics
5 class A {
6 public:
A(U p)7   template<class U> A(U p) {}
A(int p)8   template<> A(int p) {}
9 
f(U p)10   template<class U> void f(U p) {}
11 
f(int p)12   template<> void f(int p) {}
13 
f(int p)14   void f(int p) {}
15 };
16 
test1()17 void test1() {
18   A a(3);
19   char *b;
20   a.f(b);
21   a.f<int>(99);
22   a.f(100);
23 }
24 
25 template<class T> class B {
26 public:
B(U p)27   template<class U> B(U p) {}
B(int p)28   template<> B(int p) {}
29 
f(U p)30   template<class U> void f(U p) { T y = 9; }
31 
f(int p)32   template<> void f(int p) {
33     T a = 3;
34   }
35 
f(int p)36   void f(int p) { T a = 3; }
37 };
38 
test2()39 void test2() {
40   B<char> b(3);
41   char *ptr;
42   b.f(ptr);
43   b.f<int>(99);
44   b.f(100);
45 }
46 
47 namespace PR12709 {
48   template<class T> class TemplateClass {
member_function()49     void member_function() { specialized_member_template<false>(); }
50 
specialized_member_template()51     template<bool b> void specialized_member_template() {}
52 
specialized_member_template()53     template<> void specialized_member_template<false>() {}
54   };
55 
f()56   void f() { TemplateClass<int> t; }
57 }
58 
59 namespace Duplicates {
60   template<typename T> struct A {
61     template<typename U> void f();
fDuplicates::A62     template<> void f<int>() {}
fDuplicates::A63     template<> void f<T>() {}
64   };
65 
66   // FIXME: We should diagnose the duplicate explicit specialization definitions
67   // here.
68   template struct A<int>;
69 }
70 
71 namespace PR28082 {
72 struct S {
73   template <int>
74   int f(int = 0);
75   template <>
76   int f<0>(int);
77 };
78 }
79