xref: /llvm-project/clang/test/SemaOpenCLCXX/address-space-of-this-class-scope.clcpp (revision d1c8a151df830c6c727f0bb7d33774bd3eb96824)
1//RUN: %clang_cc1 %s -triple spir-unknown-unknown -pedantic -verify
2
3struct C {
4  auto fGlob() __global -> decltype(this);
5  auto fGen() -> decltype(this);
6  auto fErr() __global __local -> decltype(this); //expected-error{{multiple address spaces specified for type}}
7};
8
9void bar(__local C*);
10// expected-note@-1{{candidate function not viable: cannot pass pointer to address space '__global' as a pointer to address space '__local' in 1st argument}}
11// expected-note@-2{{candidate function not viable: cannot pass pointer to default address space as a pointer to address space '__local' in 1st argument}}
12
13__global C Glob;
14void foo(){
15bar(Glob.fGlob()); // expected-error{{no matching function for call to 'bar'}}
16// FIXME: AS of 'this' below should be correctly deduced to generic
17bar(Glob.fGen()); // expected-error{{no matching function for call to 'bar'}}
18}
19