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