c++: workaround portability issue

On some systems (x86_64-pc-solaris2.11), with Developer Studio 12.5's
CC, we get:

    ".../include/CC/Cstd/vector.cc", line 127: Error: Cannot assign const yy::parser::stack_symbol_type to yy::parser::stack_symbol_type without "yy::parser::stack_symbol_type::operator=(const yy::parser::stack_symbol_type&)";.
    ".../include/CC/Cstd/vector", line 475:     Where: While instantiating "std::vector<yy::parser::stack_symbol_type>::__insert_aux(yy::parser::stack_symbol_type*, const yy::parser::stack_symbol_type&)".
    ".../include/CC/Cstd/vector", line 475:     Where: Instantiated from non-template code.
    1 Error(s) detected.

Don't expect __cplusplus to be always defined.  If it's not, consider
this is C++98.

Reported by Nelson H. F. Beebe.

* data/c++.m4, data/lalr1.cc, examples/c++/variant.yy, tests/local.at,
* tests/testsuite.h:
An undefined __cplusplus means pre C++11.
This commit is contained in:
Akim Demaille
2018-11-03 08:48:48 +01:00
parent 5a0d7802f4
commit eff6739124
5 changed files with 13 additions and 13 deletions

View File

@@ -912,14 +912,14 @@ m4_define([AT_REQUIRE_CXX_VERSION],
[AT_DATA([check.cc],
[[int main ()
{
#if __cplusplus < ]m4_case([$1],
[98], [199711],
[03], [199711],
[11], [201103],
[14], [201402],
[17], [201703],
[2a], [201709],
[m4_fatal([$0: invalid arguments: $@])])[
#if !defined __cplusplus || __cplusplus < ]m4_case([$1],
[98], [199711],
[03], [199711],
[11], [201103],
[14], [201402],
[17], [201703],
[2a], [201709],
[m4_fatal([$0: invalid arguments: $@])])[
return 77;
#else
return 0;