mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user