mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
glr2.cc: add copy constructor to yyGLRStackItem
This silences the clang warning -Wdeprecated-copy. * data/skeletons/glr2.cc: here.
This commit is contained in:
committed by
Akim Demaille
parent
93d6a5ba4d
commit
b7e2cac2aa
@@ -127,6 +127,7 @@ m4_define([b4_shared_declarations],
|
||||
b4_percent_code_get([[requires]])[
|
||||
#include <algorithm>
|
||||
#include <cstddef> // ptrdiff_t
|
||||
#include <cstring> // memcpy
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <stdexcept>
|
||||
@@ -1239,6 +1240,18 @@ struct yyGLRStackItem {
|
||||
}
|
||||
}
|
||||
|
||||
yyGLRStackItem(const yyGLRStackItem& other)
|
||||
: isState_(other.isState_) {
|
||||
std::memcpy(raw_, other.raw_, union_size);
|
||||
}
|
||||
|
||||
yyGLRStackItem& operator=(yyGLRStackItem other)
|
||||
{
|
||||
std::swap(isState_, other.isState_);
|
||||
std::swap(raw_, other.raw_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
~yyGLRStackItem() {
|
||||
if (isState()) {
|
||||
getState().~yyGLRState();
|
||||
|
||||
Reference in New Issue
Block a user