1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
libtut README for gcc 3.4 (and beyond)
======================================
gcc 3.4 has tighter checks on many aspects of C++. Thus, if you compile your
tests with g++-3.4, you may run into some problems. In particular:
- You cannot put your tests into a unnamed namespace anymore. g++ will
complain that
error: specialization of
`template<class Data> template<int n> void tut::test_object::test()'
in different namespace from definition of
`template<class Data> template<int n> void tut::test_object::test()'
the solution is to put all tests into the tut namespace.
- Without unnamed namespaces, the one-definition rule will bite if you use
multiple test files and you have lines like
typedef tut::test_group<Neuron_data> TestGroupType;
typedef TestGroupType::object TestObjectType;
TestGroupType test_group_registration("Neuron");
in your files. The problem is that test_group_registration will be defined
multiple times, which the linker will complain about:
test_Assertion.o(.bss+0x0):/usr/include/c++/3.4/bits/locale_facets.tcc:2444:
multiple definition of `tut::test_group_registration'
Here, the solution is to frame the last of the three lines in an unnamed
namespace:
typedef tut::test_group<Neuron_data> TestGroupType;
typedef TestGroupType::object TestObjectType;
namespace { TestGroupType test_group_registration("Neuron"); }
-- martin f. krafft <madduck@debian.org> Wed, 11 May 2005 21:44:11 +0200
|