diff options
author | Olly Betts <olly@survex.com> | 2023-01-05 16:54:16 +1300 |
---|---|---|
committer | Olly Betts <olly@survex.com> | 2023-05-11 13:54:30 +1200 |
commit | b1388bcbf927f666d7795592fbb151d929305802 (patch) | |
tree | 2aa78828e149bf2f136af8068eeaba6f65805d91 /Examples | |
parent | 38f8f15fcd4747cb1db136de74874dd779a75c6f (diff) | |
download | swig-b1388bcbf927f666d7795592fbb151d929305802.tar.gz |
Parse storage class more flexibly
Previously we had a hard-coded list of allowed combinations in the
grammar, but this suffers from combinatorial explosion, and results
in a vague `Syntax error in input` error for invalid (and missing)
combinations.
This means we now support a number of cases which are valid C++
but weren't supported.
Fixes #302
Fixes #2079 (friend constexpr)
Fixes #2474 (virtual explicit)
Diffstat (limited to 'Examples')
-rw-r--r-- | Examples/test-suite/cpp11_constexpr.i | 3 | ||||
-rw-r--r-- | Examples/test-suite/cpp11_noexcept.i | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/Examples/test-suite/cpp11_constexpr.i b/Examples/test-suite/cpp11_constexpr.i index 5ba9ff243..d830d984a 100644 --- a/Examples/test-suite/cpp11_constexpr.i +++ b/Examples/test-suite/cpp11_constexpr.i @@ -39,6 +39,9 @@ struct ConstExpressions { // Regression tests for https://github.com/swig/swig/issues/284 : explicit constexpr ConstExpressions(int) { } constexpr explicit ConstExpressions(double) { } + // Regression tests for https://github.com/swig/swig/issues/2079 : + constexpr friend bool operator==(ConstExpressions,ConstExpressions) { return true; } + friend constexpr bool operator!=(ConstExpressions,ConstExpressions) { return false; } }; %} diff --git a/Examples/test-suite/cpp11_noexcept.i b/Examples/test-suite/cpp11_noexcept.i index 8aa0baa5a..6b0584473 100644 --- a/Examples/test-suite/cpp11_noexcept.i +++ b/Examples/test-suite/cpp11_noexcept.i @@ -1,5 +1,7 @@ %module cpp11_noexcept +%ignore NoExceptAbstract::operator std::string; +%ignore NoExceptAbstract::operator int; %ignore NoExceptClass(NoExceptClass&&); %rename(Assignment) NoExceptClass::operator=; @@ -7,6 +9,7 @@ extern "C" void global_noexcept(int, bool) noexcept {} %} %inline %{ +#include <string> extern "C" void global_noexcept(int, bool) noexcept; extern "C" void global_noexcept2(int, bool) noexcept {} @@ -43,6 +46,9 @@ struct NoExceptClass { struct NoExceptAbstract { virtual void noo4() const noexcept = 0; virtual ~NoExceptAbstract() noexcept = 0; + // Regression test for https://github.com/swig/swig/issues/2474 + virtual explicit operator std::string() const noexcept = 0; + explicit virtual operator int() const noexcept = 0; }; struct NoExceptDefaultDelete { |