glr2.cc: fix -Wnoexcept issues

440-453 and 685 failed with GCC 12.1:

```
test.cc:1814:21:   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 '{anonymous}::glr_stack_item::glr_stack_item(bool)' [-Werror=noexcept]
   95 |     noexcept(noexcept(::new((void*)0) _Tp(std::declval<_Args>()...)))
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test.cc:1486:5: note: but '{anonymous}::glr_stack_item::glr_stack_item(bool)' does not throw; perhaps it should be declared 'noexcept'
 1486 |     glr_stack_item (bool state = true)
      |     ^~~~~~~~~~~~~~
```

Reported by Paul Eggert.
<https://lists.gnu.org/r/bison-patches/2022-07/msg00008.html>

* data/skeletons/glr2.cc (glr_state, glr_stack_item): Declare the
default ctors noexcept.
This commit is contained in:
Akim Demaille
2022-08-01 08:02:20 +02:00
parent 722070124e
commit b7bdf78c18

View File

@@ -818,7 +818,7 @@ namespace ]b4_namespace_ref[
class ]b4_parser_class[::glr_state
{
public:
glr_state ()
glr_state () YY_NOEXCEPT
: yyresolved (false)
, yylrState (0)
, yyposn (0)
@@ -1410,7 +1410,7 @@ namespace
class glr_stack_item
{
public:
glr_stack_item (bool state = true)
glr_stack_item (bool state = true) YY_NOEXCEPT
: is_state_ (state)]b4_parse_assert_if([[
, magic_ (MAGIC)]])[
{