Debian Codegraph @

gcc/testsuite/g++.dg/Wattributes-5.C

raw
1 // { dg-do compile }
2 // { dg-options "-Wattributes" }
3
4 #define ATTR(list) __attribute__ (list)
5
6 template <int>
7 struct A
8 {
9 int __attribute__ ((noinline))
10 f (); // { dg-message "previous declaration here" }
11 };
12
13 template <int N>
14 int __attribute__ ((always_inline))
15 A<N>::f () // { dg-warning "ignoring attribute .always_inline. because it conflicts with attribute .noinline." } */
16 { return 0; }
17
18
19 template <int>
20 struct B
21 {
22 int __attribute__ ((always_inline))
23 f ();
24 };
25
26 template <>
27 inline int __attribute__ ((always_inline))
28 B<0>::f ()
29 { return 0; }
30
31 template <>
32 int __attribute__ ((noinline))
33 B<1>::f ()
34 { return 1; }