blob: 4bea198d9bab7abc486492b7174b4c823b217c50 [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) {
14 int *i = t; // expected-error{{no viable conversion from 'HasFoo' to 'int *'}}
15 { }
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}}
28template void f(HasBar);
29#endif