------- Comment #9 from igodard at pacbell dot net  2006-04-20 08:20 -------
I believe it is a bug because my declaration should not be able to hijack the
use inside the STL, which should only be seeing the declarations that were
visible where the STL function was defined, which did not include any of my
code. That is, my operator should not have been on the resolution list for the
STL use. Your example  has the STL declaration *after* the operator
declaration, so the operator is visible. The test case I sent in had the STL
first.

Also, even if my operator was visible, why was it called when it wants a
specReg left operand and didn't get one? The other overloads also all want
particular classes as left operands, and the STL case should have been none of
them, even if they were visible. You have created a case where the left operand
is int but mine declarations all have particular classes as left operand.

The operator,() is used here as a metaprogramming device so that a
comma-separated list can be eaten and and its elements lightly processed and
then saved in a compile-time structure for later processing. The particular
situation requires that the form be syntactically a comma-separated list, and
some other operator or functional notation would not do. As I recall, the
swapping template was because I needed to work around a language restriction
whereby operator,() cannot discriminate on the second operand (being by
definition defined for left operand and anything). The swapping let me
double-dispatch so I could dispatch (in the second invocation) on what had been
the right operand but was now the left. But I no longer recall.

Is there anything in the Standard that precludes having a templated
operator,()? I'd guess that the same bug might be evidenced with operator&& and
operator|| as well, because these three have nonstandard (er - uncommon)
binding behavior.

Hope this helps

Ivan


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26974

Reply via email to