diff --git a/Examples/test-suite/cpp11_initializer_list.i b/Examples/test-suite/cpp11_initializer_list.i index b309576c1..c1646248c 100644 --- a/Examples/test-suite/cpp11_initializer_list.i +++ b/Examples/test-suite/cpp11_initializer_list.i @@ -10,7 +10,7 @@ $1 = {"Ab", "Fab"}; %} -%begin %{ +%runtime %{ #if __GNUC__ >= 9 /* warning: ‘new’ of initializer_list does not extend the lifetime of the underlying array [-Winit-list-lifetime] */ /* incorrect warning for C::C(std::initializer_list) */ diff --git a/Lib/swig.swg b/Lib/swig.swg index 9148c9153..6cac0e377 100644 --- a/Lib/swig.swg +++ b/Lib/swig.swg @@ -665,7 +665,9 @@ namespace std { */ #ifdef __cplusplus -%insert("runtime") %{ +// Placed in the header section to ensure the language specific header files are +// the first included headers and not +%insert("header") %{ #ifdef __cplusplus #include /* SwigValueWrapper is described in swig.swg */ @@ -688,7 +690,7 @@ public: operator T&() const { return *pointer.ptr; } #endif T *operator&() const { return pointer.ptr; } -};%} +}; /* * SwigValueInit() is a generic initialisation solution as the following approach: @@ -699,13 +701,10 @@ public: * * unsigned int c_result = unsigned int(); */ -%insert("runtime") %{ template T SwigValueInit() { return T(); } -%} -%insert("runtime") %{ #if __cplusplus >=201103L # define SWIG_STD_MOVE(OBJ) std::move(OBJ) #else