Debian Codegraph @

gcc/testsuite/g++.dg/DRs/dr2604.C

raw
1 // DR 2604 - Attributes for an explicit specialization.
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-Wunused-parameter" }
4
5 template<typename>
6 [[noreturn]] void
7 foo ([[maybe_unused]] int i)
8 {
9 for (;;);
10 }
11
12 template<>
13 void
14 foo<int> (int i) // { dg-warning "unused parameter 'i'" }
15 {
16 }
17
18 template<typename>
19 void
20 bar (int i) // { dg-warning "unused parameter 'i'" }
21 {
22 }
23
24 template<>
25 [[noreturn]] void
26 bar<int> ([[maybe_unused]] int i)
27 {
28 for (;;);
29 }
30
31 [[noreturn]] void
32 baz ()
33 {
34 foo<long> (0);
35 }
36
37 [[noreturn]] void
38 qux ()
39 {
40 foo<int> (0);
41 } // { dg-warning "'noreturn' function does return" }
42
43 [[noreturn]] void
44 garply ()
45 {
46 bar<long> (0);
47 } // { dg-warning "'noreturn' function does return" }
48
49 [[noreturn]] void
50 corge ()
51 {
52 bar<int> (0);
53 }