yhirose / cpp-peglib

A single file C++ header-only PEG (Parsing Expression Grammars) library
MIT License
900 stars 112 forks source link

compiling with -Woverloaded-virtual fails #118

Closed xmaton closed 4 years ago

xmaton commented 4 years ago

We compile our project with -Woverloaded-virtual and when I try to include the peglib it fails to compile:

In file included from ../main.cpp:20:
.././peglib.h:1722:16: error: ‘virtual void peg::Ope::Visitor::visit(peg::PrecedenceClimbing&)’ was hidden [-Werror=overloaded-virtual]
 1722 |   virtual void visit(PrecedenceClimbing & /*ope*/) {}
      |                ^~~~~
.././peglib.h:1726:8: error:   by ‘virtual void peg::IsReference::visit(peg::Reference&)’ [-Werror=overloaded-virtual]
 1726 |   void visit(Reference & /*ope*/) override { is_reference = true; }
      |        ^~~~~
.
.
.
many more errors

It seems that basically anything that derives from Ope::Visitor should either override all virtual functions from the base class or import wholesale the base implementation by using Ope::Visitor::visit; in every visitor. Do you have any preference which way to fix the problem?

yhirose commented 4 years ago

@xmaton, thanks for the report!

xmaton commented 4 years ago

Thank you very much for the quick fix! Can you also cut a fresh release relative soon so we can sync up to a nice tag (0.1.12 or something).

Thanks again!

yhirose commented 4 years ago

@xmaton, I just bumped up the version number. Hope your project goes well!

xmaton commented 4 years ago

Excellent! Thanks!