This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Tips for not breaking -std=c++0x in libstdc++


Hi all,

As a follow-up to my patch yesterday that makes the negative C++0x
regressions tests run well when the compiler is running in C++0x mode,
I wanted to post a few tips about writing code and test-cases so that
they work well with both TR1 and the C++0x mode. There will be
another, entirely boring patch that fixes more libstdc++ tests to deal
with this:

 - Whenever you're depending on C++98 behavior, add the
"-std=gnu++98" option or check !defined(__GXX_EXPERIMENTAL_CXX0X__)

 - Don't rely on the exact text of a static assertion in a dg-error:
static assertions in C++0x produce different (better) error messages
that whatever error message is produced by the C++98 emulation of
static assertions.

 - Try to avoid "using namespace" on both "std" and "tr1". The
problem here is that the same entities show up on both places, e.g.,

     using namespace std;
     using namespace tr1;

tuple<int, float> f; // error: std::tuple or std::tr1::tuple?

The last one is probably the most important, because it can also
affect headers: you may need to qualify more names or choose your
using directives carefully to avoid ambiguities when compiling in
C++0x mode.

- Doug


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]