[Bug c++/86733] c++17 and #pragma GCC diagnostic warning "-Wall" resurrect pre-c++11 warnings.

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jul 30 10:42:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86733

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-07-30
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Presumably the handling for the pragma just turns the option on without
considering the current cxx_dialect.

This should fix it:

--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -9210,7 +9210,7 @@ cp_parser_binary_expression (cp_parser* parser, bool
cast_p,
       /* Get an operator token.  */
       token = cp_lexer_peek_token (parser->lexer);

-      if (warn_cxx11_compat
+      if (warn_cxx11_compat && cxx_dialect < cxx11
           && token->type == CPP_RSHIFT
           && !parser->greater_than_is_operator_p)
         {


More information about the Gcc-bugs mailing list