Add support for parsing C++11 final classes

Such as:

  class X final {};

This no longer gives a syntax error.
This change has introduced one more shift-reduce conflict in the parser.
with a conflict with a C style variable declaration with name final:

  class X final;

resulting in a syntax error (for C++ not C). This is an an unusual style
for C++ code and more typical declarations do work:

  X final;

Closes #672
This commit is contained in:
William S Fulton 2022-10-02 13:47:15 +01:00
commit ba279ae939
9 changed files with 267 additions and 24 deletions

View file

@ -891,6 +891,19 @@ struct DerivedStruct : BaseStruct {
};
</pre></div>
<p>
Classes can also be marked as final, such as
</p>
<div class="code"><pre>
struct FinalDerivedStruct final : BaseStruct {
virtual void ab() const override;
};
</pre></div>
<p>
<b>Compatibility note:</b> Final methods were supported much earlier than final classes. SWIG-4.1.0 was the first version to support classes marked as final.
</p>
<H3><a name="CPlusPlus11_null_pointer_constant">7.2.12 Null pointer constant</a></H3>