Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3645: iterator_facade does not work in presence of ::implicit_cast
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-11-19 18:04:42
#3645: iterator_facade does not work in presence of ::implicit_cast
-------------------------------+--------------------------------------------
Reporter: romanp@⦠| Owner:
Type: Bugs | Status: new
Milestone: Boost 1.42.0 | Component: None
Version: Boost 1.41.0 | Severity: Problem
Keywords: iterator_facade |
-------------------------------+--------------------------------------------
Comment(by romanp@â¦):
The compiler is right to complain about ambiguity.
14.8.1 - Explicit template argument specification [temp.arg.explicit]
-6- [Note: For simple function names, argument dependent lookup
(basic.lookup.koenig) applies even when the function name is not visible
within the scope of the call. This is because the call still has the
syntactic form of a function call (basic.lookup.unqual). But when a
function template with explicit template arguments is used, the call does
not have the correct syntactic form unless there is a function template
with that name visible at the point of the call. If no such name is
visible, the call is not syntactically well-formed and argument-dependent
lookup does not apply. If some such name is visible, argument dependent
lookup applies and additional function templates may be found in other
namespaces. [Example:
namespace A {
struct B { };
template<int X> void f(B);
}
namespace C {
template<class T> void f(T t);
}
void g(A::B b) {
f<3>(b); // ill-formed: not a function call
A::f<3>(b); // well-formed
C::f<3>(b); // ill-formed; argument dependent lookup
// only applies to unqualified names
using C::f;
f<3>(b); // well-formed because C::f is visible;
then
// A::f is found by argument dependent
lookup
}
--- end example]
--- end note]
Which means that iterator_facade has unintended point of extension (ADL
enabled call).
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3645#comment:2> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:01 UTC