1 | //RUN: %clang_cc1 %s -cl-std=c++ -pedantic -verify -fsyntax-only |
2 | |
3 | template <typename T> |
4 | struct S { |
5 | T a; // expected-error{{field may not be qualified with an address space}} |
6 | T f1(); // expected-error{{function type may not be qualified with an address space}} |
7 | void f2(T); // expected-error{{parameter may not be qualified with an address space}} |
8 | }; |
9 | |
10 | template <typename T> |
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'}} |
12 | return *i; |
13 | } |
14 | |
15 | template <typename T> |
16 | T *foo2(T *i) { |
17 | return i; |
18 | } |
19 | |
20 | template <typename T> |
21 | void foo3() { |
22 | __private T ii; // expected-error{{conflicting address space qualifiers are provided between types 'T' and '__global int'}} |
23 | } |
24 | |
25 | void bar() { |
26 | S<const __global int> sintgl; // expected-note{{in instantiation of template class 'S<const __global int>' requested here}} |
27 | |
28 | foo1<__local int>(1); // expected-error{{no matching function for call to 'foo1'}} |
29 | foo2<__global int>(0); |
30 | foo3<__global int>(); // expected-note{{in instantiation of function template specialization 'foo3<__global int>' requested here}} |
31 | } |
32 | |