Fortran: Fix PR 47485.
[gcc.git] / gcc / testsuite / g++.dg / warn / Wno-attributes-1.C
blob863ca5c4892c7be0d095b06db0ca0c9f8e566efa
1 // { dg-do compile { target c++11 } }
2 // { dg-options "-Wno-attributes=bar:: -Wno-attributes=baz::qux" }
4 [[foo::bar]];                           // { dg-warning "attribute ignored" }
5 [[bar::foo, foo::bar, baz::qux]];       // { dg-warning "attribute ignored" }
6 [[bar::foo, bar::bar, baz::qux]];       // { dg-bogus "attribute ignored" }
8 namespace [[foo::bar]] N {              // { dg-warning "'bar' attribute directive ignored" }
9   int n;
11 namespace [[bar::foo, foo::bar, baz::qux]] O { // { dg-warning "'bar' attribute directive ignored" }
12   int o;
14 namespace [[bar::foo, bar::bar, baz::qux]] P { // { dg-bogus "attribute directive ignored" }
15   int p;
18 void
19 foo ()
21   int i = 0;
22   [[foo::bar]];                         // { dg-warning "attributes at the beginning of statement are ignored" }
23   [[bar::foo, foo::bar, baz::qux]];     // { dg-warning "attributes at the beginning of statement are ignored" }
24   [[bar::foo, bar::bar, baz::qux]];     // { dg-bogus "attributes at the beginning of statement are ignored" }
25   [[foo::bar]] ++i;                     // { dg-warning "attributes at the beginning of statement are ignored" }
26   [[bar::foo, foo::bar, baz::qux]] ++i; // { dg-warning "attributes at the beginning of statement are ignored" }
27   [[bar::foo, bar::bar, baz::qux]] ++i; // { dg-bogus "attributes at the beginning of statement are ignored" }
28   [[foo::bar]] asm ("");                // { dg-warning "attributes ignored on 'asm' declaration" }
29   [[bar::foo, foo::bar, baz::qux]] asm (""); // { dg-warning "attributes ignored on 'asm' declaration" }
30   [[bar::foo, bar::bar, baz::qux]] asm (""); // { dg-bogus "attributes ignored on 'asm' declaration" }
31   [[foo::bar]] using namespace N;       // { dg-warning "'bar' attribute directive ignored" }
32   [[bar::foo, foo::bar, baz::qux]] using namespace O; // { dg-warning "'bar' attribute directive ignored" }
33   [[bar::foo, bar::bar, baz::qux]] using namespace P; // { dg-bogus "attribute directive ignored" }
36 class S
38   [[foo::bar]] friend int bar (S &);    // { dg-warning "attribute ignored" }
39                                         // { dsg-message "an attribute that appertains to a friend declaration that is not a definition is ignored" "" { target *-*-* } .-1 }
40   [[bar::foo, foo::bar, baz::qux]] friend int baz (S &); // { dg-warning "attribute ignored" }
41                                         // { dsg-message "an attribute that appertains to a friend declaration that is not a definition is ignored" "" { target *-*-* } .-1 }
42   [[bar::foo, bar::bar, baz::qux]] friend int qux (S &); // { dg-warning "attribute ignored" }
43                                         // { dsg-message "an attribute that appertains to a friend declaration that is not a definition is ignored" "" { target *-*-* } .-1 }
44 public:
45   int s;
48 int [[foo::bar]] i;                     // { dg-warning "attribute ignored" }
49                                         // { dg-message "an attribute that appertains to a type-specifier is ignored" "" { target *-*-* } .-1 }
50 int [[bar::foo, foo::bar, baz::qux]] j; // { dg-warning "attribute ignored" }
51                                         // { dg-message "an attribute that appertains to a type-specifier is ignored" "" { target *-*-* } .-1 }
52 int [[bar::foo, bar::bar, baz::qux]] k; // { dg-bogus "attribute ignored" }