Skip to content

Commit e077124

Browse files
committed
[cxx-interop] Update tests for foreign reference types
This fixes errors in tests: ``` /home/build-user/swift/test/Interop/Cxx/foreign-reference/Inputs/singleton.h:8:14: error: 'operator new' is missing exception specification 'noexcept' inline void *operator new(size_t, void *p) { return p; } ^ /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/new:173:33: note: previous declaration is here _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT ```
1 parent 295ec46 commit e077124

File tree

5 files changed

+5
-10
lines changed

5 files changed

+5
-10
lines changed

test/Interop/Cxx/foreign-reference/Inputs/move-only.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
#define TEST_INTEROP_CXX_FOREIGN_REFERENCE_INPUTS_MOVE_ONLY_H
33

44
#include <stdlib.h>
5+
#include <new>
56

67
#include "visibility.h"
78

8-
inline void *operator new(size_t, void *p) { return p; }
9-
109
template <class _Tp>
1110
_Tp &&move(_Tp &t) {
1211
return static_cast<_Tp &&>(t);

test/Interop/Cxx/foreign-reference/Inputs/nullable.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
#define TEST_INTEROP_CXX_FOREIGN_REFERENCE_INPUTS_NULLABLE_H
33

44
#include <stdlib.h>
5-
6-
inline void *operator new(size_t, void *p) { return p; }
5+
#include <new>
76

87
struct __attribute__((swift_attr("import_as_ref"))) Empty {
98
int test() const { return 42; }

test/Interop/Cxx/foreign-reference/Inputs/pod.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
#define TEST_INTEROP_CXX_FOREIGN_REFERENCE_INPUTS_POD_H
33

44
#include <stdlib.h>
5+
#include <new>
56

67
#include "visibility.h"
78

89
template <class From, class To>
910
To __swift_interopStaticCast(From from) { return from; }
1011

11-
inline void *operator new(size_t, void *p) { return p; }
12-
1312
SWIFT_BEGIN_NULLABILITY_ANNOTATIONS
1413

1514
struct __attribute__((swift_attr("import_as_ref"))) Empty {

test/Interop/Cxx/foreign-reference/Inputs/singleton.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
#define TEST_INTEROP_CXX_FOREIGN_REFERENCE_INPUTS_SINGLETON_H
33

44
#include <stdlib.h>
5+
#include <new>
56

67
#include "visibility.h"
78

8-
inline void *operator new(size_t, void *p) { return p; }
9-
109
SWIFT_BEGIN_NULLABILITY_ANNOTATIONS
1110

1211
struct __attribute__((swift_attr("import_as_ref"))) DeletedDtor {

test/Interop/Cxx/foreign-reference/Inputs/witness-table.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
#define TEST_INTEROP_CXX_FOREIGN_REFERENCE_INPUTS_WITNESS_TABLE_H
33

44
#include <stdlib.h>
5-
6-
inline void *operator new(size_t, void *p) { return p; }
5+
#include <new>
76

87
struct __attribute__((swift_attr("import_as_ref"))) CxxLinkedList {
98
int value = 3;

0 commit comments

Comments
 (0)