summaryrefslogtreecommitdiff
path: root/test/SemaCUDA
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-07-12 23:23:01 +0000
committerJustin Lebar <jlebar@google.com>2016-07-12 23:23:01 +0000
commit2a9beb2f57348499a2f08d604592b060c3f9ad00 (patch)
tree6be893f6a06aad00e09e3fe35aaecc97558200d6 /test/SemaCUDA
parent1cda5f1160423a020d8b39539344d088c0d5c900 (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275231 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCUDA')
-rw-r--r--test/SemaCUDA/call-overloaded-destructor.cu17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/SemaCUDA/call-overloaded-destructor.cu b/test/SemaCUDA/call-overloaded-destructor.cu
new file mode 100644
index 0000000000..24b0e7d330
--- /dev/null
+++ b/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();
+}