diff options
author | Artem Belevich <tra@google.com> | 2016-10-21 20:34:05 +0000 |
---|---|---|
committer | Artem Belevich <tra@google.com> | 2016-10-21 20:34:05 +0000 |
commit | e7cf8220a5965cc96fe224142331a7dc58394313 (patch) | |
tree | 2f8f2cb96b2aba478ddb3e0c349182c59e2a445a /test/SemaCUDA | |
parent | e88386391ce221229abd19f9c4fd624ffdd5aa88 (diff) |
Declare H and H new/delete.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284879 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCUDA')
-rw-r--r-- | test/SemaCUDA/overloaded-delete.cu | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/test/SemaCUDA/overloaded-delete.cu b/test/SemaCUDA/overloaded-delete.cu index e582fedb0a..95a93a7a54 100644 --- a/test/SemaCUDA/overloaded-delete.cu +++ b/test/SemaCUDA/overloaded-delete.cu @@ -16,10 +16,54 @@ __host__ __device__ void test(S* s) { delete s; } +// Code should work with no explicit declarations/definitions of +// allocator functions. +__host__ __device__ void test_default_global_delete_hd(int *ptr) { + // Again, there should be no ambiguity between which operator delete we call. + ::delete ptr; +} + +__device__ void test_default_global_delete(int *ptr) { + // Again, there should be no ambiguity between which operator delete we call. + ::delete ptr; +} +__host__ void test_default_global_delete(int *ptr) { + // Again, there should be no ambiguity between which operator delete we call. + ::delete ptr; +} + +// It should work with only some of allocators (re-)declared. +__device__ void operator delete(void *ptr); + +__host__ __device__ void test_partial_global_delete_hd(int *ptr) { + // Again, there should be no ambiguity between which operator delete we call. + ::delete ptr; +} + +__device__ void test_partial_global_delete(int *ptr) { + // Again, there should be no ambiguity between which operator delete we call. + ::delete ptr; +} +__host__ void test_partial_global_delete(int *ptr) { + // Again, there should be no ambiguity between which operator delete we call. + ::delete ptr; +} + + +// We should be able to define both host and device variants. __host__ void operator delete(void *ptr) {} __device__ void operator delete(void *ptr) {} -__host__ __device__ void test_global_delete(int *ptr) { +__host__ __device__ void test_overloaded_global_delete_hd(int *ptr) { + // Again, there should be no ambiguity between which operator delete we call. + ::delete ptr; +} + +__device__ void test_overloaded_global_delete(int *ptr) { + // Again, there should be no ambiguity between which operator delete we call. + ::delete ptr; +} +__host__ void test_overloaded_global_delete(int *ptr) { // Again, there should be no ambiguity between which operator delete we call. ::delete ptr; } |