Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaTemplate / ms-function-specialization-class-scope.cpp
blobdcab9bfaeabcb080e55111f289b6d3655cd64c2a
1 // RUN: %clang_cc1 -fms-extensions -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fms-extensions -fdelayed-template-parsing -fsyntax-only -verify %s
4 // expected-no-diagnostics
5 class A {
6 public:
7 template<class U> A(U p) {}
8 template<> A(int p) {}
10 template<class U> void f(U p) {}
12 template<> void f(int p) {}
14 void f(int p) {}
17 void test1() {
18 A a(3);
19 char *b;
20 a.f(b);
21 a.f<int>(99);
22 a.f(100);
25 template<class T> class B {
26 public:
27 template<class U> B(U p) {}
28 template<> B(int p) {}
30 template<class U> void f(U p) { T y = 9; }
32 template<> void f(int p) {
33 T a = 3;
36 void f(int p) { T a = 3; }
39 void test2() {
40 B<char> b(3);
41 char *ptr;
42 b.f(ptr);
43 b.f<int>(99);
44 b.f(100);
47 namespace PR12709 {
48 template<class T> class TemplateClass {
49 void member_function() { specialized_member_template<false>(); }
51 template<bool b> void specialized_member_template() {}
53 template<> void specialized_member_template<false>() {}
56 void f() { TemplateClass<int> t; }
59 namespace Duplicates {
60 template<typename T> struct A {
61 template<typename U> void f();
62 template<> void f<int>() {}
63 template<> void f<T>() {}
66 // FIXME: We should diagnose the duplicate explicit specialization definitions
67 // here.
68 template struct A<int>;
71 namespace PR28082 {
72 struct S {
73 template <int>
74 int f(int = 0);
75 template <>
76 int f<0>(int);