2010-01-01 05:34:51 -05:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
2009-06-02 13:58:47 -04:00
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
|
struct add_pointer {
|
|
|
|
|
typedef T* type; // expected-error{{'type' declared as a pointer to a reference}}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
add_pointer<int>::type test1(int * ptr) { return ptr; }
|
|
|
|
|
|
|
|
|
|
add_pointer<float>::type test2(int * ptr) {
|
2010-01-01 05:34:51 -05:00
|
|
|
return ptr; // expected-error{{cannot initialize return object of type 'add_pointer<float>::type' (aka 'float *') with an lvalue of type 'int *'}}
|
2009-06-02 13:58:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
add_pointer<int&>::type // expected-note{{in instantiation of template class 'struct add_pointer<int &>' requested here}} \
|
2009-10-14 14:03:49 -04:00
|
|
|
// expected-error {{no type named 'type' in 'struct add_pointer<int &>'}}
|
2009-06-02 13:58:47 -04:00
|
|
|
test3();
|