summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2019-09-25 19:34:34 +0200
committerAkim Demaille <akim.demaille@gmail.com>2019-09-27 08:40:52 +0200
commit406e8c7c02daf1b74eeacf9831763ceec128ab9b (patch)
treed1ba572f2a586f6c14bdfb1e5fa5fde168578739
parent97c4169f23c51176f14211f158f000ade3c65e28 (diff)
downloadbison-406e8c7c02daf1b74eeacf9831763ceec128ab9b.tar.gz
c++: add copy ctors for compatibility with the IAR compiler
Reported by Andreas Damm. https://savannah.gnu.org/support/?110032 * data/skeletons/lalr1.cc (stack_symbol_type::operator=): New overload, const, to please the IAR C++ compiler (version ca 2013).
-rw-r--r--THANKS1
-rw-r--r--data/skeletons/lalr1.cc15
2 files changed, 16 insertions, 0 deletions
diff --git a/THANKS b/THANKS
index 4d2b25f7..2cdd9b0b 100644
--- a/THANKS
+++ b/THANKS
@@ -10,6 +10,7 @@ Albert Chin-A-Young china@thewrittenword.com
Alexander Belopolsky alexb@rentec.com
Alexandre Duret-Lutz adl@lrde.epita.fr
Andre da Costa Barros andre.cbarros@yahoo.com
+Andreas Damm adamm@onica.com
Andreas Schwab schwab@suse.de
Andrew Suffield asuffield@users.sourceforge.net
Angelo Borsotti angelo.borsotti@gmail.com
diff --git a/data/skeletons/lalr1.cc b/data/skeletons/lalr1.cc
index d1c30403..3e1ac445 100644
--- a/data/skeletons/lalr1.cc
+++ b/data/skeletons/lalr1.cc
@@ -335,6 +335,10 @@ m4_define([b4_shared_declarations],
/// Assignment, needed by push_back by some old implementations.
/// Moves the contents of that.
stack_symbol_type& operator= (stack_symbol_type& that);
+
+ /// Assignment, needed by push_back by other implementations.
+ /// Needed by some other old implementations.
+ stack_symbol_type& operator= (const stack_symbol_type& that);
#endif
};
@@ -628,6 +632,17 @@ m4_if(b4_prefix, [yy], [],
#if YY_CPLUSPLUS < 201103L
]b4_parser_class[::stack_symbol_type&
+ ]b4_parser_class[::stack_symbol_type::operator= (const stack_symbol_type& that)
+ {
+ state = that.state;
+ ]b4_variant_if([b4_symbol_variant([that.type_get ()],
+ [value], [copy], [that.value])],
+ [[value = that.value;]])[]b4_locations_if([
+ location = that.location;])[
+ return *this;
+ }
+
+ ]b4_parser_class[::stack_symbol_type&
]b4_parser_class[::stack_symbol_type::operator= (stack_symbol_type& that)
{
state = that.state;