xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/assign-rvalue-message.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -Wno-objc-root-class %s
2*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fsyntax-only -verify -Wno-objc-root-class %s
3*f4a2713aSLionel Sambuc// rdar://9005189
4*f4a2713aSLionel Sambuc
5*f4a2713aSLionel Sambuc@interface Foo
6*f4a2713aSLionel Sambuc@end
7*f4a2713aSLionel Sambuc
8*f4a2713aSLionel Sambucstruct Bar {
9*f4a2713aSLionel Sambuc    int x;
10*f4a2713aSLionel Sambuc};
11*f4a2713aSLionel Sambuc
12*f4a2713aSLionel Sambuc@implementation Foo {
13*f4a2713aSLionel Sambuc    struct Bar bar;
14*f4a2713aSLionel Sambuc}
15*f4a2713aSLionel Sambuc
16*f4a2713aSLionel Sambuc- (const struct Bar)bar {
17*f4a2713aSLionel Sambuc    return bar;
18*f4a2713aSLionel Sambuc}
19*f4a2713aSLionel Sambuc
20*f4a2713aSLionel Sambuc- (void)baz {
21*f4a2713aSLionel Sambuc    bar.x = 0;
22*f4a2713aSLionel Sambuc    [self bar].x = 10; // expected-error {{assigning to 'readonly' return result of an Objective-C message not allowed}}
23*f4a2713aSLionel Sambuc}
24*f4a2713aSLionel Sambuc@end
25