swig/Examples/test-suite/cpp17_nested_namespaces.i
Olly Betts 3140acd748 Run C++14 and C++17 tests with appropriate compiler
Previously these testcases had C++98 fallback versions of the
testcase code to feed to the compiler if it didn't set __cplusplus to a
value which indicated support for the required C++ version, as well as
the C++14 or C++17 code which was fed to SWIG, and also to the compiler
if it was new enough.

This approach allowed some testing of such features with an
older compiler, but it complicates the testcases and not all new
C++ features can be tested in this way (indeed some of the existing
testcases don't fully exercise the feature being tested currently).

C++14 and C++17 support are also much more widespread than they
were 3.5 years ago when this approach was first implemented, so
it makes more sense to switch C++14 and C++17 testcases to require
a suitable compiler, like how C++11 testing always has.
2022-07-26 15:28:51 +12:00

81 lines
1.5 KiB
OpenEdge ABL

%module cpp17_nested_namespaces
// Tests c++17 style nested namespaces
%inline %{
// Tests with namespaces already defined using C++98 style (non-nested) namespaces
namespace A1 {
struct A1Struct {
void A1Method() {}
};
namespace B1 {
struct B1Struct {
void B1Method() {}
};
}
}
namespace A1::B1 {
A1Struct createA1Struct() { return ::A1::A1Struct(); }
B1Struct createB1Struct() { return ::A1::B1::B1Struct(); }
}
namespace A1 {
namespace B1 {
namespace C1 {
struct C1Struct {
void C1Method() {}
};
}
}
}
namespace A1::B1::C1 {
C1Struct createC1Struct() { return ::A1::B1::C1::C1Struct(); }
}
%}
%inline %{
// Tests with namespaces already defined using C++17 style (nested) namespaces
namespace A2::B2 {
struct B2Struct {
void B2Method() {}
};
}
namespace A2::B2 {
B2Struct createB2Struct() { return ::A2::B2::B2Struct(); }
}
namespace A2::B2::C2 {
struct C2Struct {
void C2Method() {}
};
}
namespace A2::B2::C2 {
C2Struct createC2Struct() { return ::A2::B2::C2::C2Struct(); }
}
%}
%inline %{
// Tests with namespaces already defined using C++17 style (nested) namespaces to 3 levels
namespace A3::B3::C3 {
struct C3Struct {
void C3Method() {}
};
}
namespace A3::B3::C3 {
C3Struct createC3Struct() { return ::A3::B3::C3::C3Struct(); }
}
namespace A3::B3 {
struct B3Struct {
void B3Method() {}
};
}
namespace A3::B3 {
B3Struct createB3Struct() { return ::A3::B3::B3Struct(); }
}
%}