C++: fix -Wdeprecated warnings

For instance on test 99:

    In file included from @@.cc:56:
    @@.hh:409:26: error: definition of implicit copy constructor for
                         'stack_symbol_type' is deprecated because it
                         has a user-declared copy assignment operator
                         [-Werror,-Wdeprecated]
          stack_symbol_type& operator= (const stack_symbol_type& that);
                         ^

Reported by Derek Clegg.
https://lists.gnu.org/archive/html/bison-patches/2018-05/msg00036.html

* configure.ac (warn_tests): Add -Wdeprecated.
* data/lalr1.cc (stack_symbol_type): Add an explicit copy ctor.
We cannot rely on the explicit default implementation (`= default`)
as we support C++ 98.
This commit is contained in:
Akim Demaille
2018-05-27 09:17:36 +02:00
parent 7bb478bd19
commit d17dc9a8b5
3 changed files with 11 additions and 1 deletions

View File

@@ -94,7 +94,7 @@ if test "$enable_gcc_warnings" = yes; then
# -Wno-keyword-macro: We use the "#define private public" dirty
# trick in the test suite to check some private implementation
# details for lalr1.cc.
warn_tests='-Wundef -pedantic -Wsign-compare -fno-color-diagnostics
warn_tests='-Wundef -pedantic -Wdeprecated -Wsign-compare -fno-color-diagnostics
-Wno-keyword-macro'
AC_LANG_PUSH([C])