blob: bda87f99c9a15e0910cbd25630db84e0dc284d65 [file] [log] [blame]
Francois Pichetaf0f4d02011-08-14 03:52:19 +00001// RUN: %clang_cc1 -fms-extensions -fsyntax-only -verify %s
2
3
4class A {
5public:
6 template <class U>
7 A(U p) {
8 }
9 template <>
Francois Pichet2fd9a472011-08-14 22:30:29 +000010 A(int p) { // expected-warning{{explicit specialization of 'A' within class scope is a Microsoft extension}}
Francois Pichetaf0f4d02011-08-14 03:52:19 +000011 }
12
13 template <class U>
14 void f(U p) {
15 }
16
17 template <>
Francois Pichet2fd9a472011-08-14 22:30:29 +000018 void f(int p) { // expected-warning{{explicit specialization of 'f' within class scope is a Microsoft extension}}
Francois Pichetaf0f4d02011-08-14 03:52:19 +000019 }
20
21 void f(int p) {
22 }
23};
24
25void test1()
26{
27 A a(3);
28 char* b ;
29 a.f(b);
30 a.f<int>(99);
31 a.f(100);
32}
33
34
35
36
37template <class T>
38class B {
39public:
40 template <class U>
41 B(U p) {
42 }
43 template <>
Francois Pichet2fd9a472011-08-14 22:30:29 +000044 B(int p) { // expected-warning{{explicit specialization of 'B<T>' within class scope is a Microsoft extension}}
Francois Pichetaf0f4d02011-08-14 03:52:19 +000045 }
46
47 template <class U>
48 void f(U p) {
49 T y = 9;
50 }
51
52
53 template <>
Francois Pichet2fd9a472011-08-14 22:30:29 +000054 void f(int p) { // expected-warning{{explicit specialization of 'f' within class scope is a Microsoft extension}}
Francois Pichetaf0f4d02011-08-14 03:52:19 +000055 T a = 3;
56 }
57
58 void f(int p) {
59 T a = 3;
60 }
61};
62
63void test2()
64{
65 B<char> b(3);
66 char* ptr;
67 b.f(ptr);
68 b.f<int>(99);
69 b.f(100);
70}
71