Hi! > Le 18 août 2018 à 07:36, 長田偉伸 <cbh34...@iret.co.jp> a écrit : > > [Description] > > I used flex to generate the source code. > After that, when I compiled using VisualStudio 2017, an error of > C4146 occurred. > > I modified the file containing the error as follows. > > # (original) position.hh:111 > return (0 < rhs || -static_cast<unsigned int>(rhs) < lhs > > # (edited) position.hh:111 > return (0 < rhs || -1 * static_cast<unsigned int>(rhs) < lhs > > I compiled it again and confirmed that no error occurred > > > [Environment] > OS: Windows10 > Visual Studio 2017 (C++) > > Version: bison (GNU Bison) 3.0.5 > > > Thank you,
Amazing… According to http://www.externsoft.ch/media/swf/cpp11-iso.html, we have in the grammar of C++ (with focus on what matters here): unary_expression: • postfix_expression • unary_operator cast_expression cast_expression • unary_expression • '(' type_id ')' cast_expression unary_operator: • '+' • '-' postfix_expression: • 'dynamic_cast' '<' type_id '>' '(' expression ')' • ‘static_cast' '<' type_id '>' '(' expression ')' So it is my reading that Visual Studio is wrong here. I don’t like the -1 *, could you please rather check that parens would suffice? return (0 < rhs || -(static_cast<unsigned int>(rhs)) < lhs Thanks!