diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2013-06-10 20:45:12 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2013-06-10 20:45:12 +0000 |
| commit | 6a0372513edbc473b538d2f724efac50405d6fef (patch) | |
| tree | 8f7776b7310bebaf415ac5b69e46e9f928c37144 /test/Parser/MicrosoftExtensions.cpp | |
| parent | 809500fc2c13c8173a16b052304d983864e4a1e1 (diff) | |
Notes
Diffstat (limited to 'test/Parser/MicrosoftExtensions.cpp')
| -rw-r--r-- | test/Parser/MicrosoftExtensions.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/Parser/MicrosoftExtensions.cpp b/test/Parser/MicrosoftExtensions.cpp index fd38dca194193..d8a597a8cc5b6 100644 --- a/test/Parser/MicrosoftExtensions.cpp +++ b/test/Parser/MicrosoftExtensions.cpp @@ -331,3 +331,32 @@ namespace Inheritance { class __multiple_inheritance B; class __virtual_inheritance C; } + +struct StructWithProperty { + __declspec(property) int V0; // expected-error {{expected '(' after 'property'}} + __declspec(property()) int V1; // expected-error {{property does not specify a getter or a putter}} + __declspec(property(set)) int V2; // expected-error {{putter for property must be specified as 'put', not 'set'}} expected-error {{expected '=' after 'set'}} + __declspec(property(ptu)) int V3; // expected-error {{missing 'get=' or 'put='}} + __declspec(property(ptu=PutV)) int V4; // expected-error {{expected 'get' or 'put' in property declaration}} + __declspec(property(get)) int V5; // expected-error {{expected '=' after 'get'}} + __declspec(property(get&)) int V6; // expected-error {{expected '=' after 'get'}} + __declspec(property(get=)) int V7; // expected-error {{expected name of accessor method}} + __declspec(property(get=GetV)) int V8; // no-warning + __declspec(property(get=GetV=)) int V9; // expected-error {{expected ',' or ')' at end of property accessor list}} + __declspec(property(get=GetV,)) int V10; // expected-error {{expected 'get' or 'put' in property declaration}} + __declspec(property(get=GetV,put=SetV)) int V11; // no-warning + __declspec(property(get=GetV,put=SetV,get=GetV)) int V12; // expected-error {{property declaration specifies 'get' accessor twice}} + + int GetV() { return 123; } + void SetV(int v) {} +}; +void TestProperty() { + StructWithProperty sp; + sp.V8; + sp.V8 = 0; // expected-error {{no setter defined for property 'V8'}} + int i = sp.V11; + sp.V11 = i++; + sp.V11 += 8; + sp.V11++; + ++sp.V11; +} |
