• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wdocumentation -Wdocumentation-pedantic -verify %s
2 
3 // This file contains lots of corner cases, so ensure that XML we generate is not invalid.
4 // RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s | FileCheck %s -check-prefix=WRONG
5 // WRONG-NOT: CommentXMLInvalid
6 
7 // expected-warning@+1 {{expected quoted string after equals sign}}
8 /// <a href=>
9 int test_html1(int);
10 
11 // expected-warning@+1 {{expected quoted string after equals sign}}
12 /// <a href==>
13 int test_html2(int);
14 
15 // expected-warning@+2 {{expected quoted string after equals sign}}
16 // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
17 /// <a href= blah
18 int test_html3(int);
19 
20 // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
21 /// <a =>
22 int test_html4(int);
23 
24 // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
25 /// <a "aaa">
26 int test_html5(int);
27 
28 // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
29 /// <a a="b" =>
30 int test_html6(int);
31 
32 // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
33 /// <a a="b" "aaa">
34 int test_html7(int);
35 
36 // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
37 /// <a a="b" =
38 int test_html8(int);
39 
40 // expected-warning@+2 {{HTML start tag prematurely ended, expected attribute name or '>'}} expected-note@+1 {{HTML tag started here}}
41 /** Aaa bbb<img ddd eee
42  * fff ggg.
43  */
44 int test_html9(int);
45 
46 // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
47 /** Aaa bbb<img ddd eee 42%
48  * fff ggg.
49  */
50 int test_html10(int);
51 
52 // expected-warning@+1 {{HTML end tag 'br' is forbidden}}
53 /// <br></br>
54 int test_html11(int);
55 
56 /// <blockquote>Meow</blockquote>
57 int test_html_nesting1(int);
58 
59 /// <b><i>Meow</i></b>
60 int test_html_nesting2(int);
61 
62 /// <p>Aaa<br>
63 /// Bbb</p>
64 int test_html_nesting3(int);
65 
66 /// <p>Aaa<br />
67 /// Bbb</p>
68 int test_html_nesting4(int);
69 
70 // expected-warning@+1 {{HTML end tag does not match any start tag}}
71 /// <b><i>Meow</a>
72 int test_html_nesting5(int);
73 
74 // expected-warning@+2 {{HTML start tag 'i' closed by 'b'}}
75 // expected-warning@+1 {{HTML end tag does not match any start tag}}
76 /// <b><i>Meow</b></b>
77 int test_html_nesting6(int);
78 
79 // expected-warning@+2 {{HTML start tag 'i' closed by 'b'}}
80 // expected-warning@+1 {{HTML end tag does not match any start tag}}
81 /// <b><i>Meow</b></i>
82 int test_html_nesting7(int);
83 
84 
85 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
86 /// \brief\returns Aaa
87 int test_block_command1(int);
88 
89 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
90 /// \brief \returns Aaa
91 int test_block_command2(int);
92 
93 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
94 /// \brief
95 /// \returns Aaa
96 int test_block_command3(int);
97 
98 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
99 /// \brief
100 ///
101 /// \returns Aaa
102 int test_block_command4(int);
103 
104 // There is trailing whitespace on one of the following lines, don't remove it!
105 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
106 /// \brief
107 ///
108 /// \returns Aaa
109 int test_block_command5(int);
110 
111 /// \brief \c Aaa
112 int test_block_command6(int);
113 
114 // expected-warning@+5 {{duplicated command '\brief'}} expected-note@+1 {{previous command '\brief' here}}
115 /// \brief Aaa
116 ///
117 /// Bbb
118 ///
119 /// \brief Ccc
120 int test_duplicate_brief1(int);
121 
122 // expected-warning@+5 {{duplicated command '\short'}} expected-note@+1 {{previous command '\short' here}}
123 /// \short Aaa
124 ///
125 /// Bbb
126 ///
127 /// \short Ccc
128 int test_duplicate_brief2(int);
129 
130 // expected-warning@+5 {{duplicated command '\brief'}} expected-note@+1 {{previous command '\short' (an alias of '\brief') here}}
131 /// \short Aaa
132 ///
133 /// Bbb
134 ///
135 /// \brief Ccc
136 int test_duplicate_brief3(int);
137 
138 
139 // expected-warning@+5 {{duplicated command '\return'}} expected-note@+1 {{previous command '\return' here}}
140 /// \return Aaa
141 ///
142 /// Bbb
143 ///
144 /// \return Ccc
145 int test_duplicate_returns1(int);
146 
147 // expected-warning@+5 {{duplicated command '\returns'}} expected-note@+1 {{previous command '\returns' here}}
148 /// \returns Aaa
149 ///
150 /// Bbb
151 ///
152 /// \returns Ccc
153 int test_duplicate_returns2(int);
154 
155 // expected-warning@+5 {{duplicated command '\result'}} expected-note@+1 {{previous command '\result' here}}
156 /// \result Aaa
157 ///
158 /// Bbb
159 ///
160 /// \result Ccc
161 int test_duplicate_returns3(int);
162 
163 // expected-warning@+5 {{duplicated command '\return'}} expected-note@+1 {{previous command '\returns' (an alias of '\return') here}}
164 /// \returns Aaa
165 ///
166 /// Bbb
167 ///
168 /// \return Ccc
169 int test_duplicate_returns4(int);
170 
171 
172 // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
173 /// \param a Blah blah.
174 int test_param1;
175 
176 // expected-warning@+1 {{empty paragraph passed to '\param' command}}
177 /// \param
178 /// \param a Blah blah.
179 int test_param2(int a);
180 
181 // expected-warning@+1 {{empty paragraph passed to '\param' command}}
182 /// \param a
183 int test_param3(int a);
184 
185 /// \param a Blah blah.
186 int test_param4(int a);
187 
188 /// \param [in] a Blah blah.
189 int test_param5(int a);
190 
191 /// \param [out] a Blah blah.
192 int test_param6(int a);
193 
194 /// \param [in,out] a Blah blah.
195 int test_param7(int a);
196 
197 // expected-warning@+1 {{whitespace is not allowed in parameter passing direction}}
198 /// \param [ in ] a Blah blah.
199 int test_param8(int a);
200 
201 // expected-warning@+1 {{whitespace is not allowed in parameter passing direction}}
202 /// \param [in, out] a Blah blah.
203 int test_param9(int a);
204 
205 // expected-warning@+1 {{unrecognized parameter passing direction, valid directions are '[in]', '[out]' and '[in,out]'}}
206 /// \param [ junk] a Blah blah.
207 int test_param10(int a);
208 
209 // expected-warning@+1 {{parameter 'a' not found in the function declaration}}
210 /// \param a Blah blah.
211 int test_param11();
212 
213 // expected-warning@+1 {{parameter 'A' not found in the function declaration}} expected-note@+1 {{did you mean 'a'?}}
214 /// \param A Blah blah.
215 int test_param12(int a);
216 
217 // expected-warning@+1 {{parameter 'aab' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
218 /// \param aab Blah blah.
219 int test_param13(int aaa, int bbb);
220 
221 // expected-warning@+2 {{parameter 'aab' not found in the function declaration}} expected-note@+2 {{did you mean 'bbb'?}}
222 /// \param aaa Blah blah.
223 /// \param aab Blah blah.
224 int test_param14(int aaa, int bbb);
225 
226 // expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
227 /// \param aab Blah blah.
228 int test_param15(int bbb, int ccc);
229 
230 // expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
231 /// \param aab Ccc.
232 /// \param aaa Aaa.
233 /// \param bbb Bbb.
234 int test_param16(int aaa, int bbb);
235 
236 // expected-warning@+2 {{parameter 'aab' not found in the function declaration}}
237 /// \param aaa Aaa.
238 /// \param aab Ccc.
239 /// \param bbb Bbb.
240 int test_param17(int aaa, int bbb);
241 
242 // expected-warning@+3 {{parameter 'aab' not found in the function declaration}}
243 /// \param aaa Aaa.
244 /// \param bbb Bbb.
245 /// \param aab Ccc.
246 int test_param18(int aaa, int bbb);
247 
248 class C {
249   // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}}
250   /// \param aaa Blah blah.
251   C(int bbb, int ccc);
252 
253   // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}}
254   /// \param aaa Blah blah.
255  int test_param19(int bbb, int ccc);
256 };
257 
258 // expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
259 /// \param aab Blah blah.
260 template<typename T>
261 void test_param20(int bbb, int ccc);
262 
263 // expected-warning@+3 {{parameter 'a' is already documented}}
264 // expected-note@+1 {{previous documentation}}
265 /// \param a Aaa.
266 /// \param a Aaa.
267 int test_param21(int a);
268 
269 // expected-warning@+4 {{parameter 'x2' is already documented}}
270 // expected-note@+2 {{previous documentation}}
271 /// \param x1 Aaa.
272 /// \param x2 Bbb.
273 /// \param x2 Ccc.
274 int test_param22(int x1, int x2, int x3);
275 
276 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
277 /// \param aaa Meow.
278 /// \param bbb Bbb.
279 /// \returns aaa.
280 typedef int test_param23(int aaa, int ccc);
281 
282 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
283 /// \param aaa Meow.
284 /// \param bbb Bbb.
285 /// \returns aaa.
286 typedef int (*test_param24)(int aaa, int ccc);
287 
288 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
289 /// \param aaa Meow.
290 /// \param bbb Bbb.
291 /// \returns aaa.
292 typedef int (* const test_param25)(int aaa, int ccc);
293 
294 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
295 /// \param aaa Meow.
296 /// \param bbb Bbb.
297 /// \returns aaa.
298 typedef int (C::*test_param26)(int aaa, int ccc);
299 
300 
301 // expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
302 /// \tparam T Aaa
303 int test_tparam1;
304 
305 // expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
306 /// \tparam T Aaa
307 void test_tparam2(int aaa);
308 
309 // expected-warning@+1 {{empty paragraph passed to '\tparam' command}}
310 /// \tparam
311 /// \param aaa Blah blah
312 template<typename T>
313 void test_tparam3(T aaa);
314 
315 // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
316 /// \tparam T Aaa
317 template<typename TT>
318 void test_tparam4(TT aaa);
319 
320 // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
321 /// \tparam T Aaa
322 template<typename TT>
323 class test_tparam5 {
324   // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TTT'?}}
325   /// \tparam T Aaa
326   template<typename TTT>
327   void test_tparam6(TTT aaa);
328 };
329 
330 /// \tparam T1 Aaa
331 /// \tparam T2 Bbb
332 template<typename T1, typename T2>
333 void test_tparam7(T1 aaa, T2 bbb);
334 
335 // expected-warning@+1 {{template parameter 'SomTy' not found in the template declaration}} expected-note@+1 {{did you mean 'SomeTy'?}}
336 /// \tparam SomTy Aaa
337 /// \tparam OtherTy Bbb
338 template<typename SomeTy, typename OtherTy>
339 void test_tparam8(SomeTy aaa, OtherTy bbb);
340 
341 // expected-warning@+2 {{template parameter 'T1' is already documented}} expected-note@+1 {{previous documentation}}
342 /// \tparam T1 Aaa
343 /// \tparam T1 Bbb
344 template<typename T1, typename T2>
345 void test_tparam9(T1 aaa, T2 bbb);
346 
347 /// \tparam T Aaa
348 /// \tparam TT Bbb
349 template<template<typename T> class TT>
350 void test_tparam10(TT<int> aaa);
351 
352 /// \tparam T Aaa
353 /// \tparam TT Bbb
354 /// \tparam TTT Ccc
355 template<template<template<typename T> class TT, class C> class TTT>
356 void test_tparam11();
357 
358 /// \tparam I Aaa
359 template<int I>
360 void test_tparam12();
361 
362 template<typename T, typename U>
363 class test_tparam13 { };
364 
365 /// \tparam T Aaa
366 template<typename T>
367 using test_tparam14 = test_tparam13<T, int>;
368 
369 // expected-warning@+1 {{template parameter 'U' not found in the template declaration}} expected-note@+1 {{did you mean 'T'?}}
370 /// \tparam U Aaa
371 template<typename T>
372 using test_tparam15 = test_tparam13<T, int>;
373 
374 // no-warning
375 /// \returns Aaa
376 int test_returns_right_decl_1(int);
377 
378 class test_returns_right_decl_2 {
379   // no-warning
380   /// \returns Aaa
381   int test_returns_right_decl_3(int);
382 };
383 
384 // no-warning
385 /// \returns Aaa
386 template<typename T>
387 int test_returns_right_decl_4(T aaa);
388 
389 // no-warning
390 /// \returns Aaa
391 template<>
392 int test_returns_right_decl_4(int aaa);
393 
394 /// \returns Aaa
395 template<typename T>
396 T test_returns_right_decl_5(T aaa);
397 
398 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
399 /// \returns Aaa
400 int test_returns_wrong_decl_1;
401 
402 // expected-warning@+1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
403 /// \return Aaa
404 int test_returns_wrong_decl_2;
405 
406 // expected-warning@+1 {{'\result' command used in a comment that is not attached to a function or method declaration}}
407 /// \result Aaa
408 int test_returns_wrong_decl_3;
409 
410 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
411 /// \returns Aaa
412 void test_returns_wrong_decl_4(int);
413 
414 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
415 /// \returns Aaa
416 template<typename T>
417 void test_returns_wrong_decl_5(T aaa);
418 
419 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
420 /// \returns Aaa
421 template<>
422 void test_returns_wrong_decl_5(int aaa);
423 
424 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
425 /// \returns Aaa
426 struct test_returns_wrong_decl_6 { };
427 
428 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
429 /// \returns Aaa
430 class test_returns_wrong_decl_7 {
431   // expected-warning@+1 {{'\returns' command used in a comment that is attached to a constructor}}
432   /// \returns Aaa
433   test_returns_wrong_decl_7();
434 
435   // expected-warning@+1 {{'\returns' command used in a comment that is attached to a destructor}}
436   /// \returns Aaa
437   ~test_returns_wrong_decl_7();
438 };
439 
440 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
441 /// \returns Aaa
442 enum test_returns_wrong_decl_8 {
443   // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
444   /// \returns Aaa
445   test_returns_wrong_decl_9
446 };
447 
448 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
449 /// \returns Aaa
450 namespace test_returns_wrong_decl_10 { };
451 
452 
453 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
454 int test1; ///< \brief\author Aaa
455 
456 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
457 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
458 int test2, ///< \brief\author Aaa
459     test3; ///< \brief\author Aaa
460 
461 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
462 int test4; ///< \brief
463            ///< \author Aaa
464 
465 
466 // Check that we attach the comment to the declaration during parsing in the
467 // following cases.  The test is based on the fact that we don't parse
468 // documentation comments that are not attached to anything.
469 
470 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
471 /// \brief\author Aaa
472 int test_attach1;
473 
474 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
475 /// \brief\author Aaa
476 int test_attach2(int);
477 
478 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
479 /// \brief\author Aaa
480 struct test_attach3 {
481   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
482   /// \brief\author Aaa
483   int test_attach4;
484 
485   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
486   int test_attach5; ///< \brief\author Aaa
487 
488   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
489   /// \brief\author Aaa
490   int test_attach6(int);
491 };
492 
493 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
494 /// \brief\author Aaa
495 class test_attach7 {
496   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
497   /// \brief\author Aaa
498   int test_attach8;
499 
500   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
501   int test_attach9; ///< \brief\author Aaa
502 
503   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
504   /// \brief\author Aaa
505   int test_attach10(int);
506 };
507 
508 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
509 /// \brief\author Aaa
510 enum test_attach9 {
511   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
512   /// \brief\author Aaa
513   test_attach10,
514 
515   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
516   test_attach11 ///< \brief\author Aaa
517 };
518 
519 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
520 /// \brief\author Aaa
521 struct test_noattach12 *test_attach13;
522 
523 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
524 /// \brief\author Aaa
525 typedef struct test_noattach14 *test_attach15;
526 
527 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
528 /// \brief\author Aaa
529 typedef struct test_attach16 { int a; } test_attach17;
530 
531 struct S { int a; };
532 
533 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
534 /// \brief\author Aaa
535 struct S *test_attach18;
536 
537 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
538 /// \brief\author Aaa
539 typedef struct S *test_attach19;
540 
541 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
542 /// \brief\author Aaa
543 struct test_attach20;
544 
545 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
546 /// \brief\author Aaa
547 typedef struct test_attach21 {
548   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
549   /// \brief\author Aaa
550   int test_attach22;
551 } test_attach23;
552 
553 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
554 /// \brief\author Aaa
555 namespace test_attach24 {
556   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
557   /// \brief\author Aaa
558   namespace test_attach25 {
559   }
560 }
561 
562 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
563 /// \brief\author Aaa
564 /// \tparam T Aaa
565 template<typename T>
566 void test_attach26(T aaa);
567 
568 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
569 /// \brief\author Aaa
570 /// \tparam T Aaa
571 template<typename T, typename U>
572 void test_attach27(T aaa, U bbb);
573 
574 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
575 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
576 /// \brief\author Aaa
577 /// \tparam T Aaa
578 template<>
579 void test_attach27(int aaa, int bbb);
580 
581 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
582 /// \brief\author Aaa
583 /// \tparam T Aaa
584 template<typename T>
585 class test_attach28 {
586   T aaa;
587 };
588 
589 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
590 /// \brief\author Aaa
591 using test_attach29 = test_attach28<int>;
592 
593 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
594 /// \brief\author Aaa
595 /// \tparam T Aaa
596 template<typename T, typename U>
597 class test_attach30 { };
598 
599 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
600 /// \brief\author Aaa
601 /// \tparam T Aaa
602 template<typename T>
603 class test_attach30<T, int> { };
604 
605 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
606 /// \brief\author Aaa
607 template<>
608 class test_attach30<int, int> { };
609 
610 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
611 /// \brief\author Aaa
612 template<typename T>
613 using test_attach31 = test_attach30<T, int>;
614 
615 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
616 /// \brief\author Aaa
617 /// \tparam T Aaa
618 template<typename T, typename U, typename V>
619 class test_attach32 { };
620 
621 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
622 /// \brief\author Aaa
623 /// \tparam T Aaa
624 template<typename T, typename U>
625 class test_attach32<T, U, int> { };
626 
627 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
628 /// \brief\author Aaa
629 /// \tparam T Aaa
630 template<typename T>
631 class test_attach32<T, int, int> { };
632 
633 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
634 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
635 /// \brief\author Aaa
636 /// \tparam T Aaa
637 template<>
638 class test_attach32<int, int, int> { };
639 
640 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
641 /// \brief\author Aaa
642 class test_attach33 {
643   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
644   /// \brief\author Aaa
645   /// \tparam T Aaa
646   template<typename T, typename U>
647   void test_attach34(T aaa, U bbb);
648 };
649 
650 template<typename T>
651 class test_attach35 {
652   // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
653   // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
654   /// \brief\author Aaa
655   /// \tparam T Aaa
656   template<typename TT, typename UU>
657   void test_attach36(TT aaa, UU bbb);
658 };
659 
660 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
661 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
662 /// \brief\author Aaa
663 /// \tparam T Aaa
664 template<> template<>
test_attach36(int aaa,int bbb)665 void test_attach35<int>::test_attach36(int aaa, int bbb) {}
666 
667 template<typename T>
668 class test_attach37 {
669   // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
670   // expected-warning@+2 {{'\tparam' command used in a comment that is not attached to a template declaration}}
671   /// \brief\author Aaa
672   /// \tparam T Aaa
673   void test_attach38(int aaa, int bbb);
674 
675   void test_attach39(int aaa, int bbb);
676 };
677 
678 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
679 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
680 /// \brief\author Aaa
681 /// \tparam T Aaa
682 template<>
test_attach38(int aaa,int bbb)683 void test_attach37<int>::test_attach38(int aaa, int bbb) {}
684 
685 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
686 /// \brief\author Aaa
687 /// \tparam T Aaa
688 template<typename T>
test_attach39(int aaa,int bbb)689 void test_attach37<T>::test_attach39(int aaa, int bbb) {}
690 
691 // We used to emit warning that parameter 'a' is not found because we parsed
692 // the comment in context of the redeclaration which does not have parameter
693 // names.
694 template <typename T>
695 struct test_attach38 {
696   /*!
697     \param a  First param
698     \param b  Second param
699   */
700   template <typename B>
701   void test_attach39(T a, B b);
702 };
703 
704 template <>
705 template <typename B>
706 void test_attach38<int>::test_attach39(int, B);
707 
708 
709 // PR13411, reduced.  We used to crash on this.
710 /**
711  * @code Aaa.
712  */
713 void test_nocrash1(int);
714 
715 // We used to crash on this.
716 // expected-warning@+2 {{empty paragraph passed to '\param' command}}
717 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
718 /// \param\brief
719 void test_nocrash2(int);
720 
721 // PR13593, example 1 and 2
722 
723 /**
724 * Bla.
725 */
726 template <typename>
727 void test_nocrash3();
728 
729 /// Foo
730 template <typename, typename>
test_nocrash4()731 void test_nocrash4() { }
732 
733 template <typename>
test_nocrash3()734 void test_nocrash3()
735 {
736 }
737 
738 // PR13593, example 3
739 
740 /**
741  * aaa
742  */
743 template <typename T>
test_nocrash5(T a1)744 inline T test_nocrash5(T a1)
745 {
746     return a1;
747 }
748 
749 ///
750 //,
751 
test_nocrash6()752 inline void test_nocrash6()
753 {
754     test_nocrash5(1);
755 }
756 
757 // We used to crash on this.
758 
759 /*!
760   Blah.
761 */
762 typedef const struct test_nocrash7 * test_nocrash8;
763 
764