@@ -178,6 +178,95 @@ void OuterClass::NestedClass::nestedMemberFunc() {}
178
178
179
179
} // namespace
180
180
181
+ namespace {
182
+
183
+ class MyClassOutOfAnon {
184
+ public:
185
+ MyClassOutOfAnon ();
186
+ MyClassOutOfAnon (const MyClassOutOfAnon&) {}
187
+ // CHECK-MESSAGES-MEM: :[[@LINE-1]]:3: warning: place definition of method 'MyClassOutOfAnon' outside of an anonymous namespace
188
+ MyClassOutOfAnon (MyClassOutOfAnon&&) = default ;
189
+ // CHECK-MESSAGES-MEM: :[[@LINE-1]]:3: warning: place definition of method 'MyClassOutOfAnon' outside of an anonymous namespace
190
+ MyClassOutOfAnon& operator =(const MyClassOutOfAnon&);
191
+ MyClassOutOfAnon& operator =(MyClassOutOfAnon&&);
192
+ bool operator <(const MyClassOutOfAnon&) const ;
193
+ void memberFunction ();
194
+ static void staticMemberFunction ();
195
+ void memberDefinedInClass () {}
196
+ // CHECK-MESSAGES-MEM: :[[@LINE-1]]:8: warning: place definition of method 'memberDefinedInClass' outside of an anonymous namespace
197
+ static void staticMemberDefinedInClass () {}
198
+ // CHECK-MESSAGES-MEM: :[[@LINE-1]]:15: warning: place definition of method 'staticMemberDefinedInClass' outside of an anonymous namespace
199
+ template <typename T>
200
+ void templateFunction ();
201
+ template <typename T>
202
+ void templateFunctionInClass () {}
203
+ // CHECK-MESSAGES-MEM: :[[@LINE-1]]:8: warning: place definition of method 'templateFunctionInClass' outside of an anonymous namespace
204
+ };
205
+
206
+ } // namespace
207
+
208
+ MyClassOutOfAnon::MyClassOutOfAnon () {}
209
+
210
+ MyClassOutOfAnon& MyClassOutOfAnon::operator =(const MyClassOutOfAnon&) { return *this ; }
211
+
212
+ MyClassOutOfAnon& MyClassOutOfAnon::operator =(MyClassOutOfAnon&&) = default ;
213
+
214
+ bool MyClassOutOfAnon::operator <(const MyClassOutOfAnon&) const { return true ; }
215
+
216
+ void MyClassOutOfAnon::memberFunction () {}
217
+
218
+ void MyClassOutOfAnon::staticMemberFunction () {}
219
+
220
+ template <typename T>
221
+ void MyClassOutOfAnon::templateFunction () {}
222
+
223
+ namespace {
224
+
225
+ template <typename T>
226
+ class TemplateClassOutOfAnon {
227
+ public:
228
+ TemplateClassOutOfAnon ();
229
+ TemplateClassOutOfAnon (const TemplateClassOutOfAnon&) {}
230
+ // CHECK-MESSAGES-MEM: :[[@LINE-1]]:3: warning: place definition of method 'TemplateClassOutOfAnon<T>' outside of an anonymous namespace
231
+ TemplateClassOutOfAnon (TemplateClassOutOfAnon&&) = default ;
232
+ // CHECK-MESSAGES-MEM: :[[@LINE-1]]:3: warning: place definition of method 'TemplateClassOutOfAnon<T>' outside of an anonymous namespace
233
+ TemplateClassOutOfAnon& operator =(const TemplateClassOutOfAnon&);
234
+ TemplateClassOutOfAnon& operator =(TemplateClassOutOfAnon&&);
235
+ bool operator <(const TemplateClassOutOfAnon&) const ;
236
+ void memberFunc ();
237
+ T getValue () const ;
238
+ void memberDefinedInClass () {}
239
+ // CHECK-MESSAGES-MEM: :[[@LINE-1]]:8: warning: place definition of method 'memberDefinedInClass' outside of an anonymous namespace
240
+ static void staticMemberDefinedInClass () {}
241
+ // CHECK-MESSAGES-MEM: :[[@LINE-1]]:15: warning: place definition of method 'staticMemberDefinedInClass' outside of an anonymous namespace
242
+ template <typename U>
243
+ void templateMethodInTemplateClass () {}
244
+ // CHECK-MESSAGES-MEM: :[[@LINE-1]]:8: warning: place definition of method 'templateMethodInTemplateClass' outside of an anonymous namespace
245
+ private:
246
+ T Value;
247
+ };
248
+
249
+ } // namespace
250
+
251
+ template <typename T>
252
+ TemplateClassOutOfAnon<T>::TemplateClassOutOfAnon() {}
253
+
254
+ template <typename T>
255
+ TemplateClassOutOfAnon<T>& TemplateClassOutOfAnon<T>::operator =(const TemplateClassOutOfAnon&) { return *this ; }
256
+
257
+ template <typename T>
258
+ TemplateClassOutOfAnon<T>& TemplateClassOutOfAnon<T>::operator =(TemplateClassOutOfAnon&&) = default ;
259
+
260
+ template <typename T>
261
+ bool TemplateClassOutOfAnon<T>::operator <(const TemplateClassOutOfAnon&) const { return true ; }
262
+
263
+ template <typename T>
264
+ void TemplateClassOutOfAnon<T>::memberFunc() {}
265
+
266
+ template <typename T>
267
+ T TemplateClassOutOfAnon<T>::getValue() const { return Value; }
268
+
269
+
181
270
#define DEFINE_FUNCTION (name ) \
182
271
namespace { \
183
272
void name () {} \
0 commit comments