1 // RUN: %clang_cc1 -x c++ -fms-extensions -fsyntax-only -emit-pch -o %t %s
2 // RUN: %clang_cc1 -x c++ -fms-extensions -fsyntax-only -include-pch %t %s -verify
3 
4 #ifndef HEADER
5 #define HEADER
6 template<typename T>
7 void f(T t) {
8   __if_exists(T::foo) {
9     { }
10     t.foo();
11   }
12 
13   __if_not_exists(T::bar) {
14     int *i = t;
15     { }
16   }
17 }
18 #else
19 struct HasFoo {
20   void foo();
21 };
22 struct HasBar {
23   void bar(int);
24   void bar(float);
25 };
26 
27 template void f(HasFoo); // expected-note{{in instantiation of function template specialization 'f<HasFoo>' requested here}}
28                          // expected-error@14{{no viable conversion from 'HasFoo' to 'int *'}}
29 template void f(HasBar);
30 #endif
31