mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
c++: use modern idioms to make classes non-copyable
Reported by Don Macpherson. https://lists.gnu.org/r/bug-bison/2019-05/msg00015.html https://github.com/akimd/bison/issues/36 * data/skeletons/lalr1.cc, data/skeletons/stack.hh, * data/skeletons/variant.hh: Delete the copy-ctor and the copy operator.
This commit is contained in:
@@ -115,6 +115,13 @@ m4_define([b4_value_type_declare],
|
||||
new (yyas_<T> ()) T (YY_MOVE (t));
|
||||
}
|
||||
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
/// Non copyable.
|
||||
semantic_type (const self_type&) = delete;
|
||||
/// Non copyable.
|
||||
self_type& operator= (const self_type&) = delete;
|
||||
#endif
|
||||
|
||||
/// Destruction, allowed only if empty.
|
||||
~semantic_type () YY_NOEXCEPT
|
||||
{]b4_parse_assert_if([
|
||||
@@ -258,9 +265,12 @@ m4_define([b4_value_type_declare],
|
||||
}
|
||||
|
||||
private:
|
||||
/// Prohibit blind copies.
|
||||
self_type& operator= (const self_type&);
|
||||
#if YY_CPLUSPLUS < 201103L
|
||||
/// Non copyable.
|
||||
semantic_type (const self_type&);
|
||||
/// Non copyable.
|
||||
self_type& operator= (const self_type&);
|
||||
#endif
|
||||
|
||||
/// Accessor to raw memory as \a T.
|
||||
template <typename T>
|
||||
|
||||
Reference in New Issue
Block a user