bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems testing Bison with GCC 12.1


From: Akim Demaille
Subject: Re: Problems testing Bison with GCC 12.1
Date: Mon, 1 Aug 2022 07:18:12 +0200


> Le 1 août 2022 à 07:02, Akim Demaille <akim.demaille@gmail.com> a écrit :
> 
>> Many C++ tests (400-25, 440-53, 664-5, 667-76, 679-80, 682-3, 685-9, 692) 
>> fail with diagnostics like "noexcept-expression evaluates to 'false' because 
>> of a call to 'yy::parser::stack_symbol_type::stack_symbol_type()' 
>> [-Werror=noexcept]".
> 
> I'll have a look at that.

I'm installing this:

commit 722070124e991ee93ec3ffbde631b5f3713cd9f0
Author: Akim Demaille <akim.demaille@gmail.com>
Date:   Mon Aug 1 07:08:52 2022 +0200

    lalr1.cc: declare stack_symbol_type as noexcept
    
    Many C++ tests (400-25, 440-53, 664-5, 667-76, 679-80, 682-3, 685-9,
    692) failed with GCC 12.1:
    
    ```
    test.cc:843:28:   required from here
    /opt/local/include/gcc12/c++/bits/stl_construct.h:95:14: error: 
noexcept-expression evaluates to 'false' because of a call to 
'yy::parser::stack_symbol_type::stack_symbol_type()' [-Werror=noexcept]
       95 |     noexcept(noexcept(::new((void*)0) 
_Tp(std::declval<_Args>()...)))
          |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    test.cc:990:3: note: but 
'yy::parser::stack_symbol_type::stack_symbol_type()' does not throw; perhaps it 
should be declared 'noexcept'
      990 |   parser::stack_symbol_type::stack_symbol_type ()
          |   ^~~~~~
    ```
    
    Reported by Paul Eggert.
    <https://lists.gnu.org/r/bison-patches/2022-07/msg00008.html>
    
    * data/skeletons/lalr1.cc (stack_symbol_type::stack_symbol_type()):
    Declare noexcept.

diff --git a/data/skeletons/lalr1.cc b/data/skeletons/lalr1.cc
index ce4c6a3d..240f4c36 100644
--- a/data/skeletons/lalr1.cc
+++ b/data/skeletons/lalr1.cc
@@ -425,7 +425,7 @@ m4_define([b4_shared_declarations],
       /// Superclass.
       typedef basic_symbol<by_state> super_type;
       /// Construct an empty symbol.
-      stack_symbol_type ();
+      stack_symbol_type () YY_NOEXCEPT;
       /// Move or copy construction.
       stack_symbol_type (YY_RVREF (stack_symbol_type) that);
       /// Steal the contents from \a sym to build this.
@@ -678,7 +678,7 @@ m4_if(b4_prefix, [yy], [],
       return YY_CAST (symbol_kind_type, yystos_[+state]);
   }
 
-  ]b4_parser_class[::stack_symbol_type::stack_symbol_type ()
+  ]b4_parser_class[::stack_symbol_type::stack_symbol_type () YY_NOEXCEPT
   {}
 
   ]b4_parser_class[::stack_symbol_type::stack_symbol_type (YY_RVREF 
(stack_symbol_type) that)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]