llvm-project/clang/test/SemaOpenCLCXX/address-space-of-this-class-scope.clcpp
Anastasia Stulova d1c8a151df [OpenCL] Added distinct file extension for C++ for OpenCL.
Files compiled with C++ for OpenCL mode can now have a distinct
file extension - clcpp, then clang driver picks the compilation
mode automatically (-x clcpp) without the use of -cl-std=clc++.

Differential Revision: https://reviews.llvm.org/D96771
2021-03-24 13:07:04 +00:00

19 lines
865 B
Plaintext

//RUN: %clang_cc1 %s -triple spir-unknown-unknown -pedantic -verify
struct C {
auto fGlob() __global -> decltype(this);
auto fGen() -> decltype(this);
auto fErr() __global __local -> decltype(this); //expected-error{{multiple address spaces specified for type}}
};
void bar(__local C*);
// expected-note@-1{{candidate function not viable: cannot pass pointer to address space '__global' as a pointer to address space '__local' in 1st argument}}
// expected-note@-2{{candidate function not viable: cannot pass pointer to default address space as a pointer to address space '__local' in 1st argument}}
__global C Glob;
void foo(){
bar(Glob.fGlob()); // expected-error{{no matching function for call to 'bar'}}
// FIXME: AS of 'this' below should be correctly deduced to generic
bar(Glob.fGen()); // expected-error{{no matching function for call to 'bar'}}
}