| 1 | // RUN: %clang_cc1 -std=c++11 -fsyntax-only %s -verify |
| 2 | |
| 3 | [[gsl::suppress("globally")]]; |
| 4 | |
| 5 | namespace N { |
| 6 | [[gsl::suppress("in-a-namespace")]]; |
| 7 | } |
| 8 | |
| 9 | [[gsl::suppress("readability-identifier-naming")]] |
| 10 | void f_() { |
| 11 | int *p; |
| 12 | [[gsl::suppress("type", "bounds")]] { |
| 13 | p = reinterpret_cast<int *>(7); |
| 14 | } |
| 15 | |
| 16 | [[gsl::suppress]] int x; // expected-error {{'suppress' attribute takes at least 1 argument}} |
| 17 | [[gsl::suppress()]] int y; // expected-error {{'suppress' attribute takes at least 1 argument}} |
| 18 | int [[gsl::suppress("r")]] z; // expected-error {{'suppress' attribute cannot be applied to types}} |
| 19 | [[gsl::suppress(f_)]] float f; // expected-error {{'suppress' attribute requires a string}} |
| 20 | } |
| 21 | |
| 22 | union [[gsl::suppress("type.1")]] U { |
| 23 | int i; |
| 24 | float f; |
| 25 | }; |
| 26 | |