llvm-project/clang/test/SemaCXX/address-space-arithmetic.cpp
Alexey Bader e95ee300c0 [SYCL] Prohibit arithmetic operations for incompatible pointers
Summary:
This change enables OpenCL diagnostics for the pointers annotated with
address space attribute SYCL mode.

Move `isAddressSpaceOverlapping` method from PointerType to QualType.

Reviewers: Anastasia, rjmccall

Reviewed By: rjmccall

Subscribers: rjmccall, jeroen.dobbelaere, Fznamznon, yaxunl, ebevhan, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D80317
2020-05-22 13:43:24 +03:00

7 lines
320 B
C++

// RUN: %clang_cc1 -fsyntax-only -verify %s
int *foo(__attribute__((opencl_private)) int *p,
__attribute__((opencl_local)) int *l) {
return p - l; // expected-error {{arithmetic operation with operands of type ('__private int *' and '__local int *') which are pointers to non-overlapping address spaces}}
}