Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/warn/Wmismatched-tags-5.C @ 152:2b5abeee2509
update gcc11
author | anatofuz |
---|---|
date | Mon, 25 May 2020 07:50:57 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
145:1830386684a0 | 152:2b5abeee2509 |
---|---|
1 /* PR c++/93810 - missing -Wmismatched-tags and -Wredundant-tags on a typedef | |
2 of an implicit class template specialization | |
3 { dg-do compile } | |
4 { dg-options "-Wall -Wmismatched-tags" } | |
5 { dg-require-effective-target c++11 } */ | |
6 | |
7 class A; // { dg-message "declared as 'class'" } | |
8 typedef A A0; | |
9 typedef class A A0; | |
10 typedef struct A A0; // { dg-warning "-Wmismatched-tags" } | |
11 | |
12 template <int> struct B; // { dg-message "declared as 'struct'" } | |
13 typedef B<0> B0; | |
14 typedef class B<0> B0; // { dg-warning "-Wmismatched-tags" } | |
15 typedef struct B<0> B0; | |
16 | |
17 | |
18 // Exercise member types of templates with non-type arguments. | |
19 template <int> struct CN; // { dg-message "declared as 'struct'" } | |
20 | |
21 template <int N> | |
22 struct X_CNp1 { | |
23 typedef CN<N + 1> CNp1; | |
24 }; | |
25 | |
26 template <int N> | |
27 struct X_class_CNp1 { | |
28 typedef class CN<N + 1> CNp1; // { dg-warning "-Wmismatched-tags" } | |
29 }; | |
30 | |
31 template <int N> | |
32 struct X_struct_CNp1 { | |
33 typedef struct CN<N + 1> CNp1; | |
34 }; | |
35 | |
36 | |
37 // Exercise partial specialization of templates with member types. | |
38 template <class> class CT1; | |
39 template <class T> struct CT1<T*> { }; | |
40 template <class T> struct CT1<T**> { }; | |
41 template <class T> class CT1<T***> { }; | |
42 | |
43 template <class> struct CT2; | |
44 template <class T> struct CT2<T*> { | |
45 // Expect class-key to match the primary. | |
46 CT1<T> ct1_0; | |
47 class CT1<T> ct1_1; | |
48 struct CT1<T> ct1_2; // { dg-warning "-Wmismatched-tags" } | |
49 | |
50 // Expect class-key to match the CT1<T*> partial specialization. | |
51 CT1<T*> ct1p1_0; | |
52 class CT1<T*> ct1p1_1; // { dg-warning "-Wmismatched-tags" } | |
53 struct CT1<T*> ct1p1_2; | |
54 | |
55 // Expect class-key to match the CT1<T**> partial specialization. | |
56 CT1<T**> ct1p2_0; | |
57 class CT1<T**> ct1p2_1; // { dg-warning "-Wmismatched-tags" } | |
58 struct CT1<T**> ct1p2_2; | |
59 | |
60 // Expect class-key to match the CT1<T***> partial specialization. | |
61 CT1<T***> ct1p3_0; | |
62 class CT1<T***> ct1p3_1; | |
63 struct CT1<T***> ct1p3_2; // { dg-warning "-Wmismatched-tags" } | |
64 | |
65 // Expect class-key to still match the CT1<T***> partial specialization. | |
66 CT1<T****> ct1p4_0; | |
67 class CT1<T****> ct1p4_1; | |
68 struct CT1<T****> ct1p4_2; // { dg-warning "-Wmismatched-tags" } | |
69 }; | |
70 | |
71 // Exercise many partial specializations (since the class-key for each | |
72 // must be tracked separately from the others). | |
73 template <class> class D; | |
74 template <class T> struct D<T*>; | |
75 template <class T> class D<T&>; | |
76 template <class T> struct D<const T*>; | |
77 template <class T> class D<const T&>; | |
78 template <class T> struct D<volatile T*>; | |
79 template <class T> class D<volatile T&>; | |
80 template <class T> struct D<const volatile T*>; | |
81 template <class T> class D<const volatile T&>; | |
82 | |
83 typedef class D<int*> DIP; // { dg-warning "-Wmismatched-tags" } | |
84 typedef struct D<int*> DIP; | |
85 typedef class D<int*> DIP; // { dg-warning "-Wmismatched-tags" } | |
86 typedef struct D<int*> DIP; | |
87 | |
88 typedef class D<int&> DIR; | |
89 typedef struct D<int&> DIR; // { dg-warning "-Wmismatched-tags" } | |
90 typedef class D<int&> DIR; | |
91 | |
92 | |
93 typedef struct D<const int*> DCIP; | |
94 typedef class D<const int*> DCIP; // { dg-warning "-Wmismatched-tags" } | |
95 typedef struct D<const int*> DCIP; | |
96 | |
97 typedef struct D<const int&> DCIR; // { dg-warning "-Wmismatched-tags" } | |
98 typedef class D<const int&> DCIR; | |
99 typedef struct D<const int&> DCIR; // { dg-warning "-Wmismatched-tags" } | |
100 | |
101 | |
102 typedef struct D<volatile int*> DVIP; | |
103 typedef class D<volatile int*> DVIP; // { dg-warning "-Wmismatched-tags" } | |
104 typedef struct D<volatile int*> DVIP; | |
105 | |
106 typedef struct D<volatile int&> DVIR; // { dg-warning "-Wmismatched-tags" } | |
107 typedef class D<volatile int&> DVIR; | |
108 typedef struct D<volatile int&> DVIR; // { dg-warning "-Wmismatched-tags" } | |
109 | |
110 | |
111 typedef struct D<const volatile int*> DCVIP; | |
112 typedef class D<const volatile int*> DCVIP; // { dg-warning "-Wmismatched-tags" } | |
113 typedef struct D<const volatile int*> DCVIP; | |
114 | |
115 typedef struct D<const volatile int&> DCVIR; // { dg-warning "-Wmismatched-tags" } | |
116 typedef class D<const volatile int&> DCVIR; | |
117 typedef struct D<const volatile int&> DCVIR; // { dg-warning "-Wmismatched-tags" } |