mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-23 03:03:02 +00:00
build: reject C++ compilers that don't support std::vector::data
GCC 4.2 on macOS claims to support C++98, but does not feature it. input.cc: In member function 'void state_stack::yycompressStack()': input.cc:1774: error: 'class std::vector<glr_stack_item, std::allocator<glr_stack_item> >' has no member named 'data' Reported by Christopher Nielsen <mascguy@github.com>. <https://trac.macports.org/raw-attachment/ticket/59927/bison-test-results-20210811-95b72.log.xz>. * m4/bison-cxx-std.m4 (_BISON_CXXSTD_98_snippet): Check for it. * m4/cxx.m4 (BISON_TEST_FOR_WORKING_CXX_COMPILER): Ditto.
This commit is contained in:
@@ -10,7 +10,20 @@ m4_define([_BISON_CXXSTD_98_snippet],
|
||||
[[#include <cassert>
|
||||
#include <vector>
|
||||
|
||||
typedef std::vector<int> ints;
|
||||
void cxx98_vector ()
|
||||
{
|
||||
typedef std::vector<int> ints;
|
||||
|
||||
// Check support for std::vector<T,Allocator>::data.
|
||||
// GCC 4.2 on macOS claims to support C++98, but does not feature it.
|
||||
//
|
||||
// input.cc: In member function 'void state_stack::yycompressStack()':
|
||||
// input.cc:1774: error: 'class std::vector<glr_stack_item, std::allocator<glr_stack_item> >' has no member named 'data'
|
||||
//
|
||||
// <https://trac.macports.org/raw-attachment/ticket/59927/bison-test-results-20210811-95b72.log.xz>.
|
||||
ints my_ints;
|
||||
assert (my_ints.data () == &my_ints[0]);
|
||||
}
|
||||
]])
|
||||
|
||||
m4_define([_BISON_CXXSTD_03_snippet],
|
||||
|
||||
Reference in New Issue
Block a user