1 //RUN: %clang_cc1 %s -pedantic -verify -ast-dump | FileCheck %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}}
11 T 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'}}
22 __private T ii; // expected-error{{conflicting address space qualifiers are provided between types '__private T' and '__global int'}}
25 template <class _Tp> struct remove_reference { typedef _Tp type; };
26 template <class _Tp> struct remove_reference<_Tp &> { typedef _Tp type; };
27 template <class _Tp> struct as_pointer {
28 typedef typename remove_reference<_Tp>::type* type;
31 // Check address space deduction in template parameter deduction.
33 // When there is no address space on a reference use __generic.
34 // CHECK: |-CXXConstructorDecl {{.*}} rep 'void (const __generic rep &__private){{.*}} __generic'
35 template<class U, class = typename as_pointer<U>::type>
39 struct rep_outer : private rep {
45 template<class T, class F>
51 S<const __global int> sintgl; // expected-note{{in instantiation of template class 'S<const __global int>' requested here}}
53 foo1<__local int>(1); // expected-error{{no matching function for call to 'foo1'}}
54 foo2<__global int>(0);
55 foo3<__global int>(); // expected-note{{in instantiation of function template specialization 'foo3<__global int>' requested here}}
59 // Preserve the address space of the type in forwarding reference.
60 // CHECK: CXXMethodDecl {{.*}} operator() 'void (__private int &__private){{.*}} const __generic'
61 foo4(i, [](auto&& x){;});