1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
2 | // RUN: %clang_cc1 -fcuda-is-device -fsyntax-only -verify %s |
3 | |
4 | #include "Inputs/cuda.h" |
5 | |
6 | // We don't allow destructors to be overloaded. Making this work would be a |
7 | // giant change to clang, and the use cases seem quite limited. |
8 | |
9 | struct A { |
10 | ~A() {} // expected-note {{previous definition is here}} |
11 | __device__ ~A() {} // expected-error {{destructor cannot be redeclared}} |
12 | }; |
13 | |
14 | struct B { |
15 | __host__ ~B() {} // expected-note {{previous definition is here}} |
16 | __host__ __device__ ~B() {} // expected-error {{destructor cannot be redeclared}} |
17 | }; |
18 | |
19 | struct C { |
20 | __host__ __device__ ~C() {} // expected-note {{previous definition is here}} |
21 | __host__ ~C() {} // expected-error {{destructor cannot be redeclared}} |
22 | }; |
23 | |
24 | struct D { |
25 | __device__ ~D() {} // expected-note {{previous definition is here}} |
26 | __host__ __device__ ~D() {} // expected-error {{destructor cannot be redeclared}} |
27 | }; |
28 | |
29 | struct E { |
30 | __host__ __device__ ~E() {} // expected-note {{previous definition is here}} |
31 | __device__ ~E() {} // expected-error {{destructor cannot be redeclared}} |
32 | }; |
33 | |
34 | |