diff options
author | Justin Lebar <jlebar@google.com> | 2016-07-12 23:23:01 +0000 |
---|---|---|
committer | Justin Lebar <jlebar@google.com> | 2016-07-12 23:23:01 +0000 |
commit | d35f706cc2849c82e6095ce93c400809771d5001 (patch) | |
tree | 3062d27ada697a264c30f2b7affe8ec388fe55fd /clang/test/SemaCUDA | |
parent | 51078b81ca7a8ef8fd20ce79f1ff637ad7bd387b (diff) | |
download | bcm5719-llvm-d35f706cc2849c82e6095ce93c400809771d5001.tar.gz bcm5719-llvm-d35f706cc2849c82e6095ce93c400809771d5001.zip |
[CUDA] Don't assume that destructors can't be overloaded.
Summary:
You can overload a destructor in CUDA, and SemaOverload needs to be
tweaked not to crash when it sees an explicit call to an overloaded
destructor.
Reviewers: rsmith
Subscribers: cfe-commits, tra
Differential Revision: http://reviews.llvm.org/D21912
llvm-svn: 275231
Diffstat (limited to 'clang/test/SemaCUDA')
-rw-r--r-- | clang/test/SemaCUDA/call-overloaded-destructor.cu | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/SemaCUDA/call-overloaded-destructor.cu b/clang/test/SemaCUDA/call-overloaded-destructor.cu new file mode 100644 index 00000000000..24b0e7d330e --- /dev/null +++ b/clang/test/SemaCUDA/call-overloaded-destructor.cu @@ -0,0 +1,17 @@ +// expected-no-diagnostics + +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fsyntax-only -fcuda-is-device -verify %s + +#include "Inputs/cuda.h" + +struct S { + __host__ ~S() {} + __device__ ~S() {} +}; + +__host__ __device__ void test() { + S s; + // This should not crash clang. + s.~S(); +} |