llvm-project
33 строки · 840.0 Байт
1// RUN: %clang_cc1 -x c++ -fms-extensions -emit-pch -o %t %s
2// RUN: %clang_cc1 -x c++ -fms-extensions -fsyntax-only -include-pch %t %s -verify
3
4// RUN: %clang_cc1 -x c++ -fms-extensions -emit-pch -fpch-instantiate-templates -o %t %s
5// RUN: %clang_cc1 -x c++ -fms-extensions -fsyntax-only -include-pch %t %s -verify
6
7#ifndef HEADER8#define HEADER9template<typename T>10void f(T t) {11__if_exists(T::foo) {12{ }13t.foo();14}15
16__if_not_exists(T::bar) {17int *i = t;18{ }19}20}
21#else22struct HasFoo {23void foo();24};25struct HasBar {26void bar(int);27void bar(float);28};29
30template 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 *'}}32template void f(HasBar);33#endif34