[Bug c++/44320] New: ADL names are looked up in namespaces that are only referenced by template arguments
sstrasser at systemhaus-gruppe dot de
gcc-bugzilla@gcc.gnu.org
Sat May 29 07:41:00 GMT 2010
I believe that the following is a bug. it is accepted by MSVC and comeau.
GCC seems to ADL-lookup names in namespaces that are only used in the template
arguments of the function arguments, for example:
A<otherns::type> a;
adl_func(a); //otherns::adl_func is called
this can cause unintended conflicts with non-function names in "otherns", e.g.
if the ADL function is called "apply" and the argument type happens to be a
template instantiated with a type from namespace boost::mpl, only the fact that
a header containing the type boost::mpl::apply is included can cause a compile
error.
here's a simplified test case that causes a conflict:
namespace mpl{
class apply{};
class vector{};
}
template<class T>
void apply(T const &){}
template<class T>
class A{};
int main(){
A<mpl::vector> a;
apply(a);
}
--
Summary: ADL names are looked up in namespaces that are only
referenced by template arguments
Product: gcc
Version: 4.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sstrasser at systemhaus-gruppe dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44320
More information about the Gcc-bugs
mailing list