[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 6/9] glr2.cc: fix GCC10 warning
From: |
Akim Demaille |
Subject: |
[PATCH 6/9] glr2.cc: fix GCC10 warning |
Date: |
Sat, 12 Sep 2020 16:51:52 +0200 |
For instance on test 433: "glr2.cc api.value.type={double}"
tests/types.at:138: $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o test test.cc $LIBS
stderr:
In file included from /opt/local/include/gcc10/c++/bits/stl_tempbuf.h:60,
from /opt/local/include/gcc10/c++/bits/stl_algo.h:62,
from /opt/local/include/gcc10/c++/algorithm:62,
from test.cc:82:
/opt/local/include/gcc10/c++/bits/stl_construct.h: In instantiation of
'constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...)
[with _Tp = glr_stack_item; _Args = {glr_stack_item}; decltype (::new(void*(0))
_Tp) = glr_stack_item*]':
/opt/local/include/gcc10/c++/bits/alloc_traits.h:514:21: required from
'static constexpr void std::allocator_traits<std::allocator<_CharT>
>::construct(std::allocator_traits<std::allocator<_CharT> >::allocator_type&,
_Up*, _Args&& ...) [with _Up = glr_stack_item; _Args = {glr_stack_item}; _Tp =
glr_stack_item; std::allocator_traits<std::allocator<_CharT> >::allocator_type
= std::allocator<glr_stack_item>]'
/opt/local/include/gcc10/c++/bits/vector.tcc:115:30: required from
'std::vector<_Tp, _Alloc>::reference std::vector<_Tp,
_Alloc>::emplace_back(_Args&& ...) [with _Args = {glr_stack_item}; _Tp =
glr_stack_item; _Alloc = std::allocator<glr_stack_item>; std::vector<_Tp,
_Alloc>::reference = glr_stack_item&]'
/opt/local/include/gcc10/c++/bits/stl_vector.h:1204:21: required from
'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp,
_Alloc>::value_type&&) [with _Tp = glr_stack_item; _Alloc =
std::allocator<glr_stack_item>; std::vector<_Tp, _Alloc>::value_type =
glr_stack_item]'
test.cc:1949:48: required from here
/opt/local/include/gcc10/c++/bits/stl_construct.h:95:14: error:
noexcept-expression evaluates to 'false' because of a call to
'glr_stack_item::glr_stack_item(const glr_stack_item&)' [-Werror=noexcept]
95 | noexcept(noexcept(::new((void*)0)
_Tp(std::declval<_Args>()...)))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test.cc:1436:3: note: but 'glr_stack_item::glr_stack_item(const
glr_stack_item&)' does not throw; perhaps it should be declared 'noexcept'
1436 | glr_stack_item(const glr_stack_item& other)
| ^~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
stdout:
tests/types.at:138: exit code was 1, expected 0
433. types.at:138: 433. glr2.cc api.value.type={double} (types.at:138):
FAILED (types.at:138)
* data/skeletons/glr2.cc (glr_stack_item): Use YY_NOEXCEPT/YY_NOTHROW.
---
data/skeletons/glr2.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/data/skeletons/glr2.cc b/data/skeletons/glr2.cc
index ac9ce051..514dfa4b 100644
--- a/data/skeletons/glr2.cc
+++ b/data/skeletons/glr2.cc
@@ -1227,7 +1227,7 @@ class glr_stack_item {
}
}
- glr_stack_item(const glr_stack_item& other)
+ glr_stack_item(const glr_stack_item& other) YY_NOEXCEPT YY_NOTHROW
: isState_(other.isState_) {
std::memcpy(raw_, other.raw_, union_size);
}
--
2.28.0
- [PATCH 0/9] glr2.cc: warnings and style, Akim Demaille, 2020/09/12
- [PATCH 1/9] glr2.cc: add copy constructor to yyGLRStackItem, Akim Demaille, 2020/09/12
- [PATCH 2/9] glr2.cc: remove C-style casts, Akim Demaille, 2020/09/12
- [PATCH 3/9] glr2.cc: remove usage of PTRDIFF_MAX, Akim Demaille, 2020/09/12
- [PATCH 4/9] glr2.cc: move StrongIndexAlias into the namespace, Akim Demaille, 2020/09/12
- [PATCH 5/9] glr2.cc: coding style changes, Akim Demaille, 2020/09/12
- [PATCH 6/9] glr2.cc: fix GCC10 warning,
Akim Demaille <=
- [PATCH 7/9] glr2.cc: formatting changes, Akim Demaille, 2020/09/12
- [PATCH 8/9] glr2.cc: get rid of the C indirection for yy_symbol_print, Akim Demaille, 2020/09/12
- [PATCH 9/9] glr2.cc: address warnings with G++ 4.8, Akim Demaille, 2020/09/12