brintos

brintos / llvm-project-archived public Read only

0
0
Text · 840 B · 36c2183 Raw
34 lines · cpp
1// RUN: %clang_cc1 -x c++ -fms-extensions -emit-pch -o %t %s2// RUN: %clang_cc1 -x c++ -fms-extensions -fsyntax-only -include-pch %t %s -verify3 4// RUN: %clang_cc1 -x c++ -fms-extensions -emit-pch -fpch-instantiate-templates -o %t %s5// RUN: %clang_cc1 -x c++ -fms-extensions -fsyntax-only -include-pch %t %s -verify6 7#ifndef HEADER8#define HEADER9template<typename T>10void f(T t) {11  __if_exists(T::foo) {12    { }13    t.foo();14  }15 16  __if_not_exists(T::bar) {17    int *i = t;18    { }19  }20}21#else22struct HasFoo { 23  void foo();24};25struct HasBar { 26  void bar(int);27  void 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