diff --git a/CMakeLists.txt b/CMakeLists.txt index de3764a..e8b73cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ set(CMAKE_CXX_EXTENSIONS OFF) if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything -Wno-c++98-compat -Wno-padded -Wno-weak-vtables -Wno-exit-time-destructors -Wno-c++2a-compat -Wno-switch-enum -Wno-c++98-compat-pedantic") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wpedantic -Wextra") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wpedantic -Wextra -Woverloaded-virtual") elseif(MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /wd4503 /wd4512 /utf-8") endif() diff --git a/peglib.h b/peglib.h index 62f143a..b285339 100644 --- a/peglib.h +++ b/peglib.h @@ -1706,6 +1706,7 @@ struct Ope::Visitor { }; struct IsReference : public Ope::Visitor { + using Ope::Visitor::visit; void visit(Reference & /*ope*/) override { is_reference = true; } bool is_reference = false; }; @@ -1741,6 +1742,8 @@ struct TraceOpeName : public Ope::Visitor { }; struct AssignIDToDefinition : public Ope::Visitor { + using Ope::Visitor::visit; + void visit(Sequence &ope) override { for (auto op : ope.opes_) { op->accept(*this); @@ -1768,6 +1771,8 @@ struct AssignIDToDefinition : public Ope::Visitor { }; struct IsLiteralToken : public Ope::Visitor { + using Ope::Visitor::visit; + void visit(PrioritizedChoice &ope) override { for (auto op : ope.opes_) { if (!IsLiteralToken::check(*op)) { return; } @@ -1789,6 +1794,8 @@ private: }; struct TokenChecker : public Ope::Visitor { + using Ope::Visitor::visit; + void visit(Sequence &ope) override { for (auto op : ope.opes_) { op->accept(*this); @@ -1883,6 +1890,8 @@ private: }; struct HasEmptyElement : public Ope::Visitor { + using Ope::Visitor::visit; + HasEmptyElement(std::list> &refs) : refs_(refs) {} @@ -1945,6 +1954,8 @@ private: }; struct DetectInfiniteLoop : public Ope::Visitor { + using Ope::Visitor::visit; + DetectInfiniteLoop(const char *s, const std::string &name) { refs_.emplace_back(s, name); } @@ -1995,6 +2006,8 @@ private: }; struct ReferenceChecker : public Ope::Visitor { + using Ope::Visitor::visit; + ReferenceChecker(const Grammar &grammar, const std::vector ¶ms) : grammar_(grammar), params_(params) {} @@ -2031,6 +2044,8 @@ private: }; struct LinkReferences : public Ope::Visitor { + using Ope::Visitor::visit; + LinkReferences(Grammar &grammar, const std::vector ¶ms) : grammar_(grammar), params_(params) {} @@ -2063,6 +2078,8 @@ private: }; struct FindReference : public Ope::Visitor { + using Ope::Visitor::visit; + FindReference(const std::vector> &args, const std::vector ¶ms) : args_(args), params_(params) {} @@ -2140,6 +2157,8 @@ private: }; struct IsPrioritizedChoice : public Ope::Visitor { + using Ope::Visitor::visit; + void visit(PrioritizedChoice & /*ope*/) override { result_ = true; } static bool check(Ope &ope) {