brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 06374bc Raw
54 lines · cpp
1// RUN: rm -rf %t2// RUN: mkdir %t3// RUN: split-file %s %t4 5// RUN: %clang_cc1  -fsyntax-only -verify %t/testing.cpp         -std=c++26 -Wno-ext-cxx-type-aware-allocators -fexceptions -DTRANSPARENT_DECL=06// RUN: %clang_cc1  -fsyntax-only -verify %t/testing.cpp         -std=c++26 -Wno-ext-cxx-type-aware-allocators -fexceptions -DTRANSPARENT_DECL=17// RUN: %clang_cc1  -fsyntax-only -verify %t/module_testing.cppm -std=c++26 -Wno-ext-cxx-type-aware-allocators -fexceptions -DTRANSPARENT_DECL=28 9//--- module_testing.cppm10// expected-no-diagnostics11export module Testing;12 13#include "testing.inc"14 15//--- testing.cpp16// expected-no-diagnostics17#include "testing.inc"18 19//--- testing.inc20namespace 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==028#define BEGIN_TRANSPARENT_DECL extern "C" {29#define END_TRANSPARENT_DECL }30#elif TRANSPARENT_DECL==131#define BEGIN_TRANSPARENT_DECL extern "C++" {32#define END_TRANSPARENT_DECL }33#elif TRANSPARENT_DECL==234#define BEGIN_TRANSPARENT_DECL export {35#define END_TRANSPARENT_DECL }36#else37#error unexpected decl kind38#endif39 40BEGIN_TRANSPARENT_DECL41  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);43END_TRANSPARENT_DECL44 45void *operator new[](std::type_identity<int>, std::size_t, std::align_val_t);46void operator delete(std::type_identity<int>, void*, std::size_t, std::align_val_t);47 48void foo() {49  int *iptr = new int;50  delete iptr;51  int *iarray = new int[5];52  delete [] iarray;53}54