|
| 1 | +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++26 -fexceptions -DTRANSPARENT_DECL=0 |
| 2 | +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++26 -fexceptions -DTRANSPARENT_DECL=1 |
| 3 | +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++26 -fexceptions -DTRANSPARENT_DECL=2 |
| 4 | + |
| 5 | +// expected-no-diagnostics |
| 6 | +#if TRANSPARENT_DECL==2 |
| 7 | +export module Testing; |
| 8 | +#endif |
| 9 | + |
| 10 | +namespace std { |
| 11 | + template <class T> struct type_identity {}; |
| 12 | + using size_t = __SIZE_TYPE__; |
| 13 | + enum class align_val_t : size_t {}; |
| 14 | + struct destroying_delete_t { explicit destroying_delete_t() = default; }; |
| 15 | +} |
| 16 | + |
| 17 | +#if TRANSPARENT_DECL==0 |
| 18 | +#define BEGIN_TRANSPARENT_DECL extern "C" { |
| 19 | +#define END_TRANSPARENT_DECL } |
| 20 | +#elif TRANSPARENT_DECL==1 |
| 21 | +#define BEGIN_TRANSPARENT_DECL extern "C++" { |
| 22 | +#define END_TRANSPARENT_DECL } |
| 23 | +#elif TRANSPARENT_DECL==2 |
| 24 | +#define BEGIN_TRANSPARENT_DECL export { |
| 25 | +#define END_TRANSPARENT_DECL } |
| 26 | +#else |
| 27 | +#error unexpected decl kind |
| 28 | +#endif |
| 29 | + |
| 30 | +BEGIN_TRANSPARENT_DECL |
| 31 | + void *operator new(std::type_identity<int>, std::size_t, std::align_val_t); |
| 32 | + void operator delete[](std::type_identity<int>, void*, std::size_t, std::align_val_t); |
| 33 | +END_TRANSPARENT_DECL |
| 34 | + |
| 35 | +void *operator new[](std::type_identity<int>, std::size_t, std::align_val_t); |
| 36 | +void operator delete(std::type_identity<int>, void*, std::size_t, std::align_val_t); |
| 37 | + |
| 38 | +void foo() { |
| 39 | + int *iptr = new int; |
| 40 | + delete iptr; |
| 41 | + int *iarray = new int[5]; |
| 42 | + delete [] iarray; |
| 43 | +} |
0 commit comments