Re: Problems testing Bison with GCC 12.1
Akim Demaille <[email protected]> Mon, 1 Aug 2022 07:18:12 +0200
| Newsgroups | gmane.comp.parsers.bison.patches |
|---|---|
| Message-ID | <[email protected]> |
> Le 1 ao=C3=BBt 2022 =C3=A0 07:02, Akim Demaille = <[email protected]> a =C3=A9crit : >=20 >> 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=3Dnoexcept]". >=20 > I'll have a look at that. I'm installing this: commit 722070124e991ee93ec3ffbde631b5f3713cd9f0 Author: Akim Demaille <[email protected]> Date: Mon Aug 1 07:08:52 2022 +0200 lalr1.cc: declare stack_symbol_type as noexcept =20 Many C++ tests (400-25, 440-53, 664-5, 667-76, 679-80, 682-3, 685-9, 692) failed with GCC 12.1: =20 ``` 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=3Dnoexcept] 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 () | ^~~~~~ ``` =20 Reported by Paul Eggert. <https://lists.gnu.org/r/bison-patches/2022-07/msg00008.html> =20 * 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]); } =20 - ]b4_parser_class[::stack_symbol_type::stack_symbol_type () + ]b4_parser_class[::stack_symbol_type::stack_symbol_type () = YY_NOEXCEPT {} =20 ]b4_parser_class[::stack_symbol_type::stack_symbol_type (YY_RVREF = (stack_symbol_type) that)