@@ -158,4 +158,53 @@ struct A {
158
158
const char [] A::f = " f" ;
159
159
// expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
160
160
}
161
- // CHECK: 15 errors generated.
161
+
162
+ namespace gh147333 {
163
+ template <class T , char fmt>
164
+ constexpr inline auto & to_print_fmt = " " ;
165
+ template <> constexpr inline char [] to_print_fmt<unsigned , ' x' > = " 0x%x" ;
166
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
167
+
168
+ #ifndef FIXIT
169
+ // Further related test cases.
170
+
171
+ int [1 ] operator +();
172
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
173
+ // expected-error@-2{{function cannot return array type}}
174
+
175
+ int [1 ] operator " " _x(unsigned long long );
176
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
177
+ // expected-error@-2{{function cannot return array type}}
178
+
179
+ struct A {
180
+ int [1 ] operator int ();
181
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
182
+ // TODO: The following is too noisy and redundant.
183
+ // expected-error@-3{{conversion function cannot have a return type}}
184
+ // expected-error@-4{{cannot specify any part of a return type in the declaration of a conversion function}}
185
+ // expected-error@-5{{conversion function cannot convert to an array type}}
186
+
187
+ int [1 ] A();
188
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
189
+ // TODO: The following is too noisy and redundant.
190
+ // expected-error@-3{{function cannot return array type}}
191
+ // expected-error@-4{{constructor cannot have a return type}}
192
+
193
+ int [1 ] ~A ();
194
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
195
+ // TODO: This isn't helpful.
196
+ // expected-error@-3{{array has incomplete element type 'void'}}
197
+ };
198
+
199
+ template <typename T>
200
+ struct B {
201
+ int [1 ] B<T>();
202
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
203
+ // TODO: The following is too noisy and redundant.
204
+ // expected-error@-3{{function cannot return array type}}
205
+ // expected-error@-4{{constructor cannot have a return type}}
206
+ };
207
+ #endif
208
+ }
209
+
210
+ // CHECK: 32 errors generated.
0 commit comments