|
Boost : |
Subject: [boost] BOOST_NO_EXTERN_TEMPLATE check is broken
From: Doug Gregor (doug.gregor_at_[hidden])
Date: 2010-04-27 15:14:52
The current Boost.Config check for BOOST_NO_EXTERN_TEMPLATE uses
incorrect syntax. The test, in
libs/config/test/boost_no_extern_template.ipp, looks like this:
namespace boost_no_extern_template {
extern template<class T> void f(T);
int test()
{
return 0;
}
}
The "extern" in C++0x extern templates can only be placed on explicit
template instantiations. Here's a better test:
namespace boost_no_extern_template {
template<typename T, typename U>
void f(T* p1, U* p2) {
p1 = p2;
}
extern template void f(int*, float*);
int test() { return 0; }
}
If the compiler rejects or ignores the "extern" in that explicit
template instantiation declaration, we'll get an (invalid) compiler
error.
Grepping through the compiler configurations, BOOST_NO_EXTERN_TEMPLATE
is set for several compilers that do in fact have support for C++0x
extern templates, namely GCC and EDG-based compilers (when in either
in C++0x or non-strict mode).
- Doug
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk