diff options
author | John McCall <rjmccall@apple.com> | 2013-03-04 01:30:55 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2013-03-04 01:30:55 +0000 |
commit | 7a534b94138ef2ad1a75b26b3b5bf1aa948d4121 (patch) | |
tree | eb515bbb206f6384b79a5ccd7a6e224f0c64e8a0 /test/SemaObjCXX | |
parent | 0074d38bee15c25d3f91d4f16f223ed0dca3f33f (diff) | |
download | clang-7a534b94138ef2ad1a75b26b3b5bf1aa948d4121.tar.gz |
Perform non-overload placeholder conversions on the operands
to a subscript operator.
rdar://13332183
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176428 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaObjCXX')
-rw-r--r-- | test/SemaObjCXX/properties.mm | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/SemaObjCXX/properties.mm b/test/SemaObjCXX/properties.mm index 804d6829b1..abd4db998b 100644 --- a/test/SemaObjCXX/properties.mm +++ b/test/SemaObjCXX/properties.mm @@ -129,3 +129,38 @@ extern void* VoidType; extern decltype(TestNonTrivialObj.p1 = NonTrivial1())* VoidType; extern decltype(TestNonTrivialObj.p2 = NonTrivial2())* VoidType; +// rdar://13332183 +namespace test9 { + struct CString { + const char *_data; + char operator[](int i) const { return _data[i]; } + }; +} +@interface Test9 +@property test9::CString name; +@end +namespace test9 { + char test(Test9 *t) { + return t.name[0]; + } +} + +namespace test10 { + struct A { operator const char*(); }; + struct B { operator const char*(); }; +} +@interface Test10 +@property test10::A a; +@property test10::B b; +@property int index; +@end +namespace test10 { + void test(Test10 *t) { + (void) t.a[6]; + (void) 6[t.b]; + (void) "help"[t.index]; + (void) t.index["help"]; + (void) t.a[t.index]; + (void) t.index[t.b]; + } +} |