| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: mkdir %t |
| 3 |
// RUN: split-file %s %t |
| 4 |
|
| 5 |
// RUN: %clang_cc1 -fsyntax-only -verify %t/testing.cpp -std=c++26 -Wno-ext-cxx-type-aware-allocators -fexceptions -DTRANSPARENT_DECL=0 |
| 6 |
// RUN: %clang_cc1 -fsyntax-only -verify %t/testing.cpp -std=c++26 -Wno-ext-cxx-type-aware-allocators -fexceptions -DTRANSPARENT_DECL=1 |
| 7 |
// RUN: %clang_cc1 -fsyntax-only -verify %t/module_testing.cppm -std=c++26 -Wno-ext-cxx-type-aware-allocators -fexceptions -DTRANSPARENT_DECL=2 |
| 8 |
|
| 9 |
//--- module_testing.cppm |
| 10 |
// expected-no-diagnostics |
| 11 |
export module Testing; |
| 12 |
|
| 13 |
#include "testing.inc" |
| 14 |
|
| 15 |
//--- testing.cpp |
| 16 |
// expected-no-diagnostics |
| 17 |
#include "testing.inc" |
| 18 |
|
| 19 |
//--- testing.inc |
| 20 |
namespace std { |
| 21 |
template <class T> struct type_identity {}; |
| 22 |
using size_t = __SIZE_TYPE__; |
| 23 |
enum class align_val_t : size_t {}; |
| 24 |
struct destroying_delete_t { explicit destroying_delete_t() = default; }; |
| 25 |
} |
| 26 |
|
| 27 |
#if TRANSPARENT_DECL==0 |
| 28 |
#define BEGIN_TRANSPARENT_DECL extern "C" { |
| 29 |
#define END_TRANSPARENT_DECL } |
| 30 |
#elif TRANSPARENT_DECL==1 |
| 31 |
#define BEGIN_TRANSPARENT_DECL extern "C++" { |
| 32 |
#define END_TRANSPARENT_DECL } |
| 33 |
#elif TRANSPARENT_DECL==2 |
| 34 |
#define BEGIN_TRANSPARENT_DECL export { |
| 35 |
#define END_TRANSPARENT_DECL } |
| 36 |
#else |
| 37 |
#error unexpected decl kind |
| 38 |
#endif |
| 39 |
|
| 40 |
BEGIN_TRANSPARENT_DECL |
| 41 |
void *operator new(std::type_identity<int>, std::size_t, std::align_val_t); |
| 42 |
void operator delete[](std::type_identity<int>, void*, std::size_t, std::align_val_t); |
| 43 |
END_TRANSPARENT_DECL |
| 44 |
|
| 45 |
void *operator new[](std::type_identity<int>, std::size_t, std::align_val_t); |
| 46 |
void operator delete(std::type_identity<int>, void*, std::size_t, std::align_val_t); |
| 47 |
|
| 48 |
void foo() { |
| 49 |
int *iptr = new int; |
| 50 |
delete iptr; |
| 51 |
int *iarray = new int[5]; |
| 52 |
delete [] iarray; |
| 53 |
} |