Allow resolving headers from a PCH even after headers+PCH were moved to another path.
[clang.git] / test / SemaObjCXX / deduction.mm
blob220f36863bab7c39e17d784f6378186363f87fff
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 @class NSString;
5 // Reduced from WebKit.
6 namespace test0 {
7   template <typename T> struct RemovePointer {
8     typedef T Type;
9   };
11   template <typename T> struct RemovePointer<T*> {
12     typedef T Type;
13   };
15   template <typename T> struct RetainPtr {
16     typedef typename RemovePointer<T>::Type ValueType;
17     typedef ValueType* PtrType;
18     RetainPtr(PtrType ptr);
19   };
21   void test(NSString *S) {
22     RetainPtr<NSString*> ptr(S);
23   }
25   void test(id S) {
26     RetainPtr<id> ptr(S);
27   }
30 @class Test1Class;
31 @protocol Test1Protocol;
32 namespace test1 {
33   template <typename T> struct RemovePointer {
34     typedef T type;
35   };
36   template <typename T> struct RemovePointer<T*> {
37     typedef T type;
38   };
39   template <typename A, typename B> struct is_same {};
40   template <typename A> struct is_same<A,A> {
41     static void foo();
42   };
43   template <typename T> struct tester {
44     void test() {
45       is_same<T, typename RemovePointer<T>::type*>::foo(); // expected-error 2 {{no member named 'foo'}}
46     }
47   };
49   template struct tester<id>;
50   template struct tester<id<Test1Protocol> >;
51   template struct tester<Class>;
52   template struct tester<Class<Test1Protocol> >;
53   template struct tester<Test1Class*>;
54   template struct tester<Test1Class<Test1Protocol>*>;
56   template struct tester<Test1Class>; // expected-note {{in instantiation}}
57   template struct tester<Test1Class<Test1Protocol> >; // expected-note {{in instantiation}}
60 namespace test2 {
61   template <typename T> void foo(const T* t) {}
62   void test(id x) {
63     foo(x);
64   }