1//RUN: %clang_cc1 %s -cl-std=clc++ -pedantic -verify -fsyntax-only 2 3template <typename T> 4struct S { 5 T a; // expected-error{{field may not be qualified with an address space}} 6 T f1(); // we ignore address space on a return types. 7 void f2(T); // expected-error{{parameter may not be qualified with an address space}} 8}; 9 10template <typename T> 11T foo1(__global T *i) { // expected-note{{candidate template ignored: substitution failure [with T = __local int]: conflicting address space qualifiers are provided between types '__global T' and '__local int'}} 12 return *i; 13} 14 15template <typename T> 16T *foo2(T *i) { 17 return i; 18} 19 20template <typename T> 21void foo3() { 22 __private T ii; // expected-error{{conflicting address space qualifiers are provided between types '__private T' and '__global int'}} 23} 24 25template <class _Tp> struct remove_reference { typedef _Tp type; }; 26template <class _Tp> struct remove_reference<_Tp &> { typedef _Tp type; }; 27template <class _Tp> struct as_pointer { 28 typedef typename remove_reference<_Tp>::type* type; 29}; 30 31struct rep { 32 // CHECK |-CXXConstructorDecl {{.*}} rep 'void (const __generic rep &__private) __generic' 33 template<class U, class = typename as_pointer<U>::type> 34 rep(U&& v) {} 35}; 36 37struct rep_outer : private rep { 38 rep_outer() 39 : rep(0) {} 40}; 41 42void bar() { 43 S<const __global int> sintgl; // expected-note{{in instantiation of template class 'S<const __global int>' requested here}} 44 45 foo1<__local int>(1); // expected-error{{no matching function for call to 'foo1'}} 46 foo2<__global int>(0); 47 foo3<__global int>(); // expected-note{{in instantiation of function template specialization 'foo3<__global int>' requested here}} 48 rep_outer r; 49} 50