Add support for C++11 noexcept specification in exception specifications

This commit is contained in:
William S Fulton 2013-11-21 19:31:59 +00:00
commit f4ada30a7e
5 changed files with 151 additions and 27 deletions

View file

@ -491,6 +491,7 @@ CPP11_TEST_CASES = \
cpp11_initializer_list \
cpp11_initializer_list_extend \
cpp11_lambda_functions \
cpp11_noexcept \
cpp11_null_pointer_constant \
cpp11_raw_string_literals \
cpp11_rvalue_reference \

View file

@ -0,0 +1,48 @@
%module cpp11_noexcept
%ignore NoExceptClass(NoExceptClass&&);
%rename(Assignment) NoExceptClass::operator=;
%inline %{
extern "C" void global_noexcept(int, bool) noexcept;
struct NoExceptClass {
static const bool VeryTrue = true;
NoExceptClass() noexcept {}
NoExceptClass(const NoExceptClass&) noexcept {}
NoExceptClass(NoExceptClass&&) noexcept {}
NoExceptClass& operator=(const NoExceptClass&) noexcept {}
~NoExceptClass() noexcept {}
void noex0() noexcept {}
void noex1() noexcept(sizeof(int) == 4) {}
void noex2() noexcept(true) {}
void noex3() noexcept(false) {}
void noex4() noexcept(VeryTrue) {}
template<typename T> void template_noexcept(T) noexcept {}
void noo1() const noexcept {}
static void noo2() noexcept {}
virtual void noo3() const noexcept {}
virtual void noo4() const noexcept = delete;
virtual void noo5() const throw() = delete;
};
struct NoExceptAbstract {
virtual void noo4() const noexcept = 0;
virtual ~NoExceptAbstract() noexcept = 0;
};
struct NoExceptDefaultDelete {
// NoExceptDefaultDelete() noexcept = default;
// NoExceptDefaultDelete(const NoExceptDefaultDelete&) noexcept = delete;
NoExceptDefaultDelete(NoExceptDefaultDelete&&) = delete;
NoExceptDefaultDelete& operator=(const NoExceptDefaultDelete&) = delete;
~NoExceptDefaultDelete() noexcept = default;
};
%}