[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / PCH / ms-if-exists.cpp
blobc875b1db724508687e4118ac9c4ad623fbac6219
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
4 // RUN: %clang_cc1 -x c++ -fms-extensions -fsyntax-only -emit-pch -fpch-instantiate-templates -o %t %s
5 // RUN: %clang_cc1 -x c++ -fms-extensions -fsyntax-only -include-pch %t %s -verify
7 #ifndef HEADER
8 #define HEADER
9 template<typename T>
10 void f(T t) {
11 __if_exists(T::foo) {
12 { }
13 t.foo();
16 __if_not_exists(T::bar) {
17 int *i = t;
18 { }
21 #else
22 struct HasFoo {
23 void foo();
25 struct HasBar {
26 void bar(int);
27 void bar(float);
30 template void f(HasFoo); // expected-note{{in instantiation of function template specialization 'f<HasFoo>' requested here}}
31 // expected-error@17{{no viable conversion from 'HasFoo' to 'int *'}}
32 template void f(HasBar);
33 #endif