westes / flex

The Fast Lexical Analyzer - scanner generator for lexing in C and C++
Other
3.63k stars 536 forks source link

FYI: New warning for C++ lexer with gcc 13 -Wall #601

Open zmajeed opened 1 year ago

zmajeed commented 1 year ago

Got this warning from gcc 13 for a C++ lexer when all warnings are enabled with -Wall

error: ‘virtual int yyFlexLexer::yylex()’ was hidden [-Werror=overloaded-virtual=]

Caused by the yylex overload in my lexer derived from yyFlexLexer. I fixed it by making the inherited virtual function private

private:
  using yyFlexLexer::yylex;

More information

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87729 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20423 https://www.ibm.com/docs/en/zos/3.1.0?topic=udcmco-overloading-member-functions-from-base-derived-classes-c-only