16 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3template<typename T>4struct add_pointer {5 typedef T* type; // expected-error{{'type' declared as a pointer to a reference}}6};7 8add_pointer<int>::type test1(int * ptr) { return ptr; }9 10add_pointer<float>::type test2(int * ptr) { 11 return ptr; // expected-error{{cannot initialize return object of type 'add_pointer<float>::type' (aka 'float *') with an lvalue of type 'int *'}}12}13 14add_pointer<int&>::type // expected-note{{in instantiation of template class 'add_pointer<int &>' requested here}}15test3(); 16