summaryrefslogtreecommitdiffstats
path: root/test/SemaTemplate/instantiate-typedef.cpp
blob: 4e6cd24111c47a727aa9a33c7f23b75ebc465e38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// RUN: %clang_cc1 -fsyntax-only -verify %s

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) { 
  return ptr; // expected-error{{cannot initialize return object of type 'add_pointer<float>::type' (aka 'float *') with an lvalue of type 'int *'}}
}

add_pointer<int&>::type // expected-note{{in instantiation of template class 'add_pointer<int &>' requested here}}
test3();