Re: [PATCH 5/9] build: reject C++ compilers that don't support std::vector::data

Hans Ã…berg <[email protected]> Tue, 17 Aug 2021 15:46:39 +0200
Newsgroups gmane.comp.parsers.bison.patches
Message-ID <[email protected]>
> On 17 Aug 2021, at 08:49, Akim Demaille <[email protected]> =
wrote:
>=20
> Hi Hans,
>=20
>> Le 13 ao=C3=BBt 2021 =C3=A0 09:52, Hans =C3=85berg =
<[email protected]> a =C3=A9crit :
>>=20
>>> On 13 Aug 2021, at 08:11, Akim Demaille <[email protected]> =
wrote:
>>>=20
>>>> Le 12 ao=C3=BBt 2021 =C3=A0 10:40, Hans =C3=85berg =
<[email protected]> a =C3=A9crit :
>>>>=20
>>>> The member 'data' was introduced in C++11.
>>>>=20
>>>> https://en.cppreference.com/w/cpp/container/vector/data
>>>=20
>>> That page is exactly the one I looked at first to see that it's =
C++98, not C++11.  Read the bottom of =
<https://en.cppreference.com/w/cpp/container/vector>.
>>=20
>> It is not in the C++98 ISO+IEC+14882-1998 standard (the PDF). In the =
C++11 n3242 draft, in sec. 23.3.6.1 Class template vector overview, =
class vector has between sections "element access" and "modifiers" a =
section "data access" with
>> T* data() noexcept; const
>> T* data() const noexcept
>> and it is also in a C++ draft standard I made from sources in 2015.
>>=20
>> So GCC is right on this one, and 4.2 is from 2007-2008, before C++11. =
You might try a later version with the -std=3Dc++98 option to see what =
it does.
>=20
> You need to read my answer, and the page it pointed you to.

I checked it out on the C++ Std-Discussion list, and there is normative =
standard specifying std::vector::data before C++11. The absence in GCC =
4.2 may have to do with the MacOS version, as an earlier GCC version has =
it.

https://lists.isocpp.org/std-discussion/2021/08/1370.php