DeLesley Hutchins | df7bef0 | 2013-08-12 21:20:55 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -Wconsumed -std=c++11 %s |
| 2 | |
| 3 | #define CONSUMES __attribute__ ((consumes)) |
| 4 | #define TESTS_UNCONSUMED __attribute__ ((tests_unconsumed)) |
| 5 | #define CALLABLE_WHEN_UNCONSUMED __attribute__ ((callable_when_unconsumed)) |
| 6 | |
| 7 | class AttrTester0 { |
| 8 | void Consumes(void) __attribute__ ((consumes(42))); // expected-error {{attribute takes no arguments}} |
| 9 | bool TestsUnconsumed(void) __attribute__ ((tests_unconsumed(42))); // expected-error {{attribute takes no arguments}} |
| 10 | void CallableWhenUnconsumed(void) |
| 11 | __attribute__ ((callable_when_unconsumed(42))); // expected-error {{attribute takes no arguments}} |
| 12 | }; |
| 13 | |
| 14 | int var0 CONSUMES; // expected-warning {{'consumes' attribute only applies to methods}} |
| 15 | int var1 TESTS_UNCONSUMED; // expected-warning {{'tests_unconsumed' attribute only applies to methods}} |
| 16 | int var2 CALLABLE_WHEN_UNCONSUMED; // expected-warning {{'callable_when_unconsumed' attribute only applies to methods}} |
| 17 | |
| 18 | void function0(void) CONSUMES; // expected-warning {{'consumes' attribute only applies to methods}} |
| 19 | void function1(void) TESTS_UNCONSUMED; // expected-warning {{'tests_unconsumed' attribute only applies to methods}} |
| 20 | void function2(void) CALLABLE_WHEN_UNCONSUMED; // expected-warning {{'callable_when_unconsumed' attribute only applies to methods}} |
| 21 | |
| 22 | class AttrTester1 { |
| 23 | void consumes(void) CONSUMES; |
| 24 | bool testsUnconsumed(void) TESTS_UNCONSUMED; |
| 25 | }; |
| 26 | |
| 27 | class AttrTester2 { |
| 28 | void callableWhenUnconsumed(void) CALLABLE_WHEN_UNCONSUMED; |
| 29 | }; |