[PATCH] Make vector::data() return type consistent in C++98

Jonathan Wakely jwakely@redhat.com
Mon Oct 24 12:25:00 GMT 2016

At https://gcc.gnu.org/ml/libstdc++/2016-08/msg00123.html I suggested
changing the non-standard return type of vector::data() in C++98 mode.
Nobody objected, so I'm making that change.

This removes a silent ABI incompatibility betwen C++98 mode and later
modes, for std::vector<T, A>::data() where A::pointer is not T*.

For most uses (where A is std::allocator, or A::pointer is T*) it
makes no difference.

	* include/bits/stl_vector.h (vector::_M_data_ptr, vector::data):
	Change return type of non-standard C++98 extension to match C++11.

Tested powerpc64le-linux, with -std=gnu++98 too, committed to trunk.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 1965 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20161024/2433f847/attachment.bin>

More information about the Gcc-patches mailing list