Boost logo

Boost :

Subject: [boost] BOOST_NO_CXX11_HDR_CODECVT confusion
From: Robert Ramey (ramey_at_[hidden])
Date: 2016-11-17 13:51:43

I use BOOST_NO_CXX11_HDR_CODECVT from config.hpp in order to selectively
enable code which uses the built-in codecvt facets as opposed to the
boost "home brew" one we've been using for a long time. I do similar
things with other macros such as BOOST_NO_CXX11_HDR_FORWARD_LIST.

Problems arise when I use a recent compiler such as gcc 6.2 with the
switch -std=c++03 as in

"/hpc-6.2/usr/local/bin/g++" -ftemplate-depth-128 -std=c++03 -O0
-fno-inline -Wall -g -dynamic -gdwarf-2 -fexceptions -fPIC -arch x86_64
-Wno-unused-variable -Wno-long-long -ftemplate-depth-255
-I"../../.." -c -o

In this ease I would expect to find that BOOST_NO_CXX11_HDR_CODECVT is
defined as C++ standard does not include <codecvt> headers for versions
prior to C++ 11. But the test matrix
for this compilers shows that BOOST_NO_CXX11_HDR_CODECVT is NOT defined
when no -std=c++03 is used.

OK - I see that for gcc 6.2 the default is C++ 14 if no switch is used.
So the test matrix is OK. I'm not sure what the column is meant to test
as it does specify a particular version as the other columns do. So I
think the test for gcc 6.2 - and all the g++/clang compiler would be
improved by specifying which version of the C++ standard they are
actually testing.

But I still have a problem. When I use the swithc -std=c++03 I expect
that BOOST_NO_CXX11_HDR_CODECVT be defined as C++ versions prior to C++
11 don't have header <codecvt>. Same goes for other headers required
only for more recent compilers. But my expectations aren't realized as
BOOST_NO_CXX11_HDR_CODECVT is not defined in this case. The leads to
selection of library code which invokes an #error saying that it's not

Perhaps definition of BOOST_NO_CXX11_HDR_CODECVT is conditioned solely
on the existence of <codecvt> rather than the existence of <codecvt> and
the compiler running in C++ 11+ "mode". I think this is what is messing
things up for me.

I might be able to work around this if I config.hpp included a macro
which indicated which standard version it's intended to support. It
doesn't have this. But I wouldn't need it if the BOOST_NO... worked as
I would expect.

Robert Ramey

Boost list run by bdawes at, gregod at, cpdaniel at, john at