xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjCXX/missing-lhs-gun-extension.mm (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
2*f4a2713aSLionel Sambuc// expected-no-diagnostics
3*f4a2713aSLionel Sambuc// rdar://13749180
4*f4a2713aSLionel Sambuc
5*f4a2713aSLionel Sambuc@interface NSDictionary
6*f4a2713aSLionel Sambuc- (id)objectForKeyedSubscript:(id)key;
7*f4a2713aSLionel Sambuc- (void)setObject:(id)object forKeyedSubscript:(id)key;
8*f4a2713aSLionel Sambuc- (int &) random;
9*f4a2713aSLionel Sambuc@end
10*f4a2713aSLionel Sambuc
11*f4a2713aSLionel Sambuc@class NSString;
12*f4a2713aSLionel Sambuc
13*f4a2713aSLionel Sambuctemplate <class T, class U = T> T tfoo(U x) { return x; }
14*f4a2713aSLionel Sambuc
15*f4a2713aSLionel Sambucvoid func() {
16*f4a2713aSLionel Sambuc  NSDictionary* foo;
17*f4a2713aSLionel Sambuc  NSString* result = foo[@"bar"] ? : foo[@"baz"];
18*f4a2713aSLionel Sambuc
19*f4a2713aSLionel Sambuc  int (*fn)(int) = (&tfoo<int> ?: 0);
20*f4a2713aSLionel Sambuc
21*f4a2713aSLionel Sambuc  int x = 0;
22*f4a2713aSLionel Sambuc  const int &y = foo.random ?: x;
23*f4a2713aSLionel Sambuc}
24