blob: 4bea198d9bab7abc486492b7174b4c823b217c50 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// RUN: %clang_cc1 -x c++ -fms-extensions -fsyntax-only -emit-pch -o %t %s
// RUN: %clang_cc1 -x c++ -fms-extensions -fsyntax-only -include-pch %t %s -verify
#ifndef HEADER
#define HEADER
template<typename T>
void f(T t) {
__if_exists(T::foo) {
{ }
t.foo();
}
__if_not_exists(T::bar) {
int *i = t; // expected-error{{no viable conversion from 'HasFoo' to 'int *'}}
{ }
}
}
#else
struct HasFoo {
void foo();
};
struct HasBar {
void bar(int);
void bar(float);
};
template void f(HasFoo); // expected-note{{in instantiation of function template specialization 'f<HasFoo>' requested here}}
template void f(HasBar);
#endif
|