
"Tobias Schwinger" wrote
Your operator- (in the code of your initial post) is not the problem it must be the context it's used in.
I got a copy of your lib and comented the workaround and operator- and added
template<typename T0,typename T1> T0 operator-(T0 const &, T1 const &);
and it didn't change anything.
Does it instantiate templates that use sizeof- or conditional tricks (as BOOST_TYPEOF_TPL does)?
The pqs::meta::binary_operation result_type scheme in the operator+ definition above uses SFINAE quite heavily though. I shall try reducing it to a minimal example.
SFINAE (at least SFINAE alone) is not the problem, either. I wrote this little test which compiles fine (it would have been too easy, I guess) ;-(.
[ cut code that fails to fail ] I tried something similar with no luck. Both my quantities library and Spirit have in common that types are complicated I think. Maybe this is the cause of the problem. Say where there is a large number of contexts to look up, the first or last one gets missed or overwritten. It might be worth sprinkling likely operations around in some other namespaces mentioned in 3.4.2 to see if there is any sign of two phase lookup occurring. Whatever my first strategy is going to be to strip back my pqs library bit by bit until the bug disappears. I feel better about that than building something waiting for the bug to appear. ;-)
Boost.Typeof use in the implementation (for operations on built-in types) is optional though I havent tried turning it off yet
BOOST_TYPEOF_TPL in particular messes up ADL for the expression passed to it (the thread I linked to). Guessing from VC8's extremely strange behaviour in that case TYPEOF_TPL might act as some sort of "bug attractant"... I'd definitely give it a try!
I have tried it but It makes no difference in this particular case. FWIW if you go into <boost/pqs/config.hpp> and comment out line 30 : #define BOOST_PQS_USE_BOOST_TYPEOF_BINARY_OPERATION . Then Boost.Typeof is knocked out ... though it adds in another synthesized type deduction scheme. regards Andy Little