1 // DR 1914 - Duplicate standard attributes 2 // { dg-do compile { target c++11 } } 3 4 #define ATTR_NORETURN [[noreturn, noreturn]] 5 6 [[noreturn, noreturn]] void fn0(); // { dg-warning "specified multiple times" } 7 ATTR_NORETURN void fn0a(); 8 [[noreturn]] [[noreturn]] void fn1(); 9 [[deprecated, deprecated]] void fn2(); // { dg-warning "specified multiple times" } 10 [[deprecated]] [[deprecated]] void fn3(); 11 [[maybe_unused]] [[maybe_unused]] int fn4(); 12 [[maybe_unused, maybe_unused]] int fn5(); // { dg-warning "specified multiple times" } 13 [[nodiscard]] [[nodiscard]] int fn6(); 14 [[nodiscard, nodiscard]] int fn7(); // { dg-warning "specified multiple times" } 15 16 struct E { }; 17 struct A { 18 [[no_unique_address]] [[no_unique_address]] E e; 19 }; 20 struct B { 21 [[no_unique_address, no_unique_address]] E e; // { dg-warning "specified multiple times" } 22 }; 23 24 int f(int n)25f (int n) 26 { 27 switch (n) 28 { 29 case 1: 30 [[fallthrough, fallthrough]]; // { dg-warning "specified multiple times" } 31 case 2: 32 [[fallthrough]] [[fallthrough]]; // { dg-warning "specified multiple times" } 33 case 3: 34 return 15; 35 } 36 37 if (n == 10) 38 [[likely]] [[likely]] return 42; // { dg-warning "ignoring attribute" } 39 else if (n == 11) 40 [[unlikely]] [[unlikely]] return 10; // { dg-warning "ignoring attribute" } 41 else if (n == 12) 42 [[likely, likely]] return 42; // { dg-warning "specified multiple times" } 43 else 44 [[unlikely, unlikely]] return 0; // { dg-warning "specified multiple times" } 45 } 46