| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 |
|
| 3 |
template<typename T> |
| 4 |
struct add_pointer { |
| 5 |
typedef T* type; // expected-error{{'type' declared as a pointer to a reference}} |
| 6 |
}; |
| 7 |
|
| 8 |
add_pointer<int>::type test1(int * ptr) { return ptr; } |
| 9 |
|
| 10 |
add_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 |
|
| 14 |
add_pointer<int&>::type // expected-note{{in instantiation of template class 'add_pointer<int &>' requested here}} |
| 15 |
test3(); |