blob: 23df1d19dfd883479551aef9d88a9008d5c4bdfd [file] [log] [blame]
DeLesley Hutchinsdf7bef02013-08-12 21:20:55 +00001// 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
7class 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
14int var0 CONSUMES; // expected-warning {{'consumes' attribute only applies to methods}}
15int var1 TESTS_UNCONSUMED; // expected-warning {{'tests_unconsumed' attribute only applies to methods}}
16int var2 CALLABLE_WHEN_UNCONSUMED; // expected-warning {{'callable_when_unconsumed' attribute only applies to methods}}
17
18void function0(void) CONSUMES; // expected-warning {{'consumes' attribute only applies to methods}}
19void function1(void) TESTS_UNCONSUMED; // expected-warning {{'tests_unconsumed' attribute only applies to methods}}
20void function2(void) CALLABLE_WHEN_UNCONSUMED; // expected-warning {{'callable_when_unconsumed' attribute only applies to methods}}
21
22class AttrTester1 {
23 void consumes(void) CONSUMES;
24 bool testsUnconsumed(void) TESTS_UNCONSUMED;
25};
26
27class AttrTester2 {
28 void callableWhenUnconsumed(void) CALLABLE_WHEN_UNCONSUMED;
29};