blob: e582fedb0aa88828c375519b41ec8143e5079a99 [file] [log] [blame]
Justin Lebar4c2c6fd2016-07-12 23:23:12 +00001// expected-no-diagnostics
2
3// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s
4// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fsyntax-only -fcuda-is-device -verify %s
5
6#include "Inputs/cuda.h"
7
8struct S {
9 __host__ static void operator delete(void*, size_t) {}
10 __device__ static void operator delete(void*, size_t) {}
11};
12
13__host__ __device__ void test(S* s) {
14 // This shouldn't be ambiguous -- we call the host overload in host mode and
15 // the device overload in device mode.
16 delete s;
17}
18
19__host__ void operator delete(void *ptr) {}
20__device__ void operator delete(void *ptr) {}
21
22__host__ __device__ void test_global_delete(int *ptr) {
23 // Again, there should be no ambiguity between which operator delete we call.
24 ::delete ptr;
25}