|
Boost : |
From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2004-06-21 11:16:57
Some months ago I proposed to include a defect macro
to detect some defficiencies by several compilers regarding
the ability to handle pointers to data members as template
parameters.
The name we came up with is
BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS
I include a little test case that successfully detects the bug
in three out of the four compilers checked to show the problem
* MSVC 6.5 (MSKB article ##249045),
* MSVC 7.0 (***)
* ICC 7.0/7.1 for Windows (support issue #207321),
* VisualAge 6.0 for AIX (internal defect #288539.)
The compiler marked with (***) does fail with the test, but only under
certain compiler settings that I've not been able to isolate properly.
When last discussed, it was argued that a new defect macro would only
make
sense if some lib needed it: now Boost.MultiIndex can take advantage of
it
(actually, the lib assumes the macro even if not currently supported by
Boost.Config),
and the problem has turned out to be more prevalent than the original
MSVC-constrained case hinted at.
Is it OK to add this to Boost.Config? Comment?
Thank you,
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
*** BEGIN TEST CODE***
#include <iostream>
struct pair
{
int x,y;
pair(int x_,int y_):x(x_),y(y_){}
};
template<int pair::* PtrToPairMember>
struct foo
{
int bar(pair& p){return p.*PtrToPairMember;}
};
int main()
{
pair p(0,1);
foo<&pair::x> fx;
foo<&pair::y> fy;
if(fx.bar(p)!=0||fy.bar(p)!=1)std::cout<<"KO"<<std::endl;
else std::cout<<"OK"<<std::endl;
return 0;
}
***END TEST CODE***
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk