[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sr #110032] For C++98 stack_symbol_type defines only non-const oper
Re: [sr #110032] For C++98 stack_symbol_type defines only non-const operator=
Wed, 25 Sep 2019 21:46:41 +0200
> Le 25 sept. 2019 à 18:38, anonymous <address@hidden> a écrit :
> Summary: For C++98 stack_symbol_type defines only non-const
> Project: Bison
> Submitted by: None
> Submitted on: Wed 25 Sep 2019 04:38:56 PM UTC
> Category: None
> Priority: 5 - Normal
> Severity: 3 - Normal
> Status: None
> Privacy: Public
> Assigned to: None
> Originator Email: address@hidden
> Open/Closed: Open
> Discussion Lock: Any
> Operating System: None
For the record, what version of Bison was this? It's amazing that the bug
report form does not ask for such an information piece of information...
> Setting the output language to C++ and compiling the output with a C++98
> compiler, compilation fails on the IAR C++ compiler (version 188.8.131.5274).
I have never heard of this compiler before. It does not seem possible to use
it in our CI, that's a pity. Have to tried to run Bison's test suite with this
C++ compiler? It would be nice to get the result, and in the future to have
someone agree to check betas of Bisons :)
> The std::vector class of the IAR compiler relies on operator= in its push_back
> implementation. Defining 'stack_symbol_type &operator=(stack_symbol_type &)'
> stops the compiler implicitly generating operator= for other arguments.
> Specifically 'const stack_symbol_type &operator=(const stack_symbol_type &) is
> missing which is needed by std::vector::push_back.
> The lalr1.cc skeleton needs to be changed to also define the const operator=
> for stack_symbol_type (and also others like sematic_type when using variants)
That was introduced in
released in 3.2.4.
Could you please try this?
Author: Akim Demaille <address@hidden>
Date: Wed Sep 25 19:34:34 2019 +0200
WIP: add copy ctors
* #: .
diff --git a/data/skeletons/lalr1.cc b/data/skeletons/lalr1.cc
index d1c30403..cfca80b2 100644
@@ -335,6 +335,9 @@ 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.
+ stack_symbol_type& operator= (const stack_symbol_type& that);
@@ -627,6 +630,17 @@ m4_if(b4_prefix, [yy], ,
#if YY_CPLUSPLUS < 201103L
+ ]b4_parser_class[::stack_symbol_type::operator= (const stack_symbol_type&
+ 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::operator= (stack_symbol_type& that)
- Re: [sr #110032] For C++98 stack_symbol_type defines only non-const operator=,
Akim Demaille <=