brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 3e9b4f8 Raw
60 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s2 3template<typename T>4struct X0 {5  void f(T &t) {6    t = 1; // expected-error{{incompatible integer to pointer conversion}}7  }8  9  void g(T &t);10  11  void h(T &t);12  13  static T static_var;14};15 16template<typename T>17inline void X0<T>::g(T & t) {18  t = 1; // expected-error{{incompatible integer to pointer conversion}}19}20 21template<typename T>22void X0<T>::h(T & t) {23  t = 1;24}25 26template<typename T>27T X0<T>::static_var = 1;28 29extern template struct X0<int*>;30 31int *&test(X0<int*> xi, int *ip) {32  xi.f(ip); // expected-note{{instantiation}}33  xi.g(ip); // expected-note{{instantiation}}34  xi.h(ip);35  return X0<int*>::static_var;36}37 38template<typename T>39void f0(T& t) {40  t = 1; // expected-error{{incompatible integer to pointer conversion}}41}42 43template<typename T>44inline void f1(T& t) {45  t = 1; // expected-error 2{{incompatible integer to pointer conversion}}46}47 48extern template void f0<>(int *&);49extern template void f1<>(int *&);50 51void test_f0(int *ip, float *fp) {52  f0(ip);53  f0(fp); // expected-note{{instantiation}}54}55 56void test_f1(int *ip, float *fp) {57  f1(ip); // expected-note{{instantiation}}58  f1(fp); // expected-note{{instantiation}}59}60