blob: be29ac62ef24f55c75ba2beff6757648b66a3976 [file] [log] [blame]
Douglas Gregorba0513d2011-10-25 01:33:02 +00001// 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
6template<typename T>
7void f(T t) {
8 __if_exists(T::foo) {
9 { }
10 t.foo();
11 }
12
13 __if_not_exists(T::bar) {
Jordan Rose78541c42012-07-11 19:58:23 +000014 int *i = t;
Douglas Gregorba0513d2011-10-25 01:33:02 +000015 { }
16 }
17}
18#else
19struct HasFoo {
20 void foo();
21};
22struct HasBar {
23 void bar(int);
24 void bar(float);
25};
26
27template void f(HasFoo); // expected-note{{in instantiation of function template specialization 'f<HasFoo>' requested here}}
Jordan Rose78541c42012-07-11 19:58:23 +000028 // expected-error@14{{no viable conversion from 'HasFoo' to 'int *'}}
Douglas Gregorba0513d2011-10-25 01:33:02 +000029template void f(HasBar);
30#endif