This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Using gcc-6.2 with -std=c++03 switch leads to compile errors
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Edward Diener <eldlistmailingz at tropicsoft dot com>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Fri, 16 Dec 2016 11:00:25 +0000
- Subject: Re: Using gcc-6.2 with -std=c++03 switch leads to compile errors
- Authentication-results: sourceware.org; auth=none
- References: <o30e7j$upe$1@blaine.gmane.org>
On 16 December 2016 at 10:04, Edward Diener wrote:
> I am testing gcc-6.2 with the -std=c++03 switch against some Boost C++ code
> in a library which does not require c++11 on up support. Without going into
> the exact code I am seeing a compiler error along the lines of:
>
> some_path/some_header_file.hpp:224:20: error: no matching function for call
> to 'std::pair<int&, std::__cxx11::basic_string<char>&>::pair(int&,
> std::__cxx11::basic_string<char>&)'
>
> This implies that even when the -std=c++03 switch with gcc-6.2 c++11
> constructs are being internally used.
No it doesn't, see
https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
Whether the __cxx11 ABI is used or not orthogonal to the -std option.
It's controlled by a macro. If you compile with
-D_GLIBCXX_USE_CXX11_ABI=0 you'll see the exact same error without the
__cxx11 qualification.
> Testing the exact same code with the
> -std=c++11 switch or with the -std=c++14 switch there are no errors. Does
> this mean that using gcc-6.2 with -std=c++03 does not work with gcc-6.2, or
> is there something other compiler switch I must use along with the
> -std=c++03 switch to be able to compile using gcc-6.2 in c++03 mode ?
There is no other switch, -std=c++03 is all that's needed, and you're
misinterpreting the error.
I would guess that the code is using std::make_pair with an explicit
template argument list, which changed meaning between C++03 and C++11,
so the code is simply not compatible with C++03.