public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/44320]  New: ADL names are looked up in namespaces that are only referenced by template arguments
@ 2010-05-29  7:41 sstrasser at systemhaus-gruppe dot de
  2010-05-29  7:45 ` [Bug c++/44320] " sstrasser at systemhaus-gruppe dot de
  2010-05-29  9:31 ` paolo dot carlini at oracle dot com
  0 siblings, 2 replies; 3+ messages in thread
From: sstrasser at systemhaus-gruppe dot de @ 2010-05-29  7:41 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/44320] ADL names are looked up in namespaces that are only referenced by template arguments
  2010-05-29  7:41 [Bug c++/44320] New: ADL names are looked up in namespaces that are only referenced by template arguments sstrasser at systemhaus-gruppe dot de
@ 2010-05-29  7:45 ` sstrasser at systemhaus-gruppe dot de
  2010-05-29  9:31 ` paolo dot carlini at oracle dot com
  1 sibling, 0 replies; 3+ messages in thread
From: sstrasser at systemhaus-gruppe dot de @ 2010-05-29  7:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from sstrasser at systemhaus-gruppe dot de  2010-05-29 07:45 -------
a workaround (other than renaming the ADL function) would be appreciated


-- 


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/44320] ADL names are looked up in namespaces that are only referenced by template arguments
  2010-05-29  7:41 [Bug c++/44320] New: ADL names are looked up in namespaces that are only referenced by template arguments sstrasser at systemhaus-gruppe dot de
  2010-05-29  7:45 ` [Bug c++/44320] " sstrasser at systemhaus-gruppe dot de
@ 2010-05-29  9:31 ` paolo dot carlini at oracle dot com
  1 sibling, 0 replies; 3+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-05-29  9:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from paolo dot carlini at oracle dot com  2010-05-29 09:30 -------
Works fine in 4_5-branch and mainline, the behavior in 4_3-branch and
4_4-branch isn't a regression in any way, as fas as I can see.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
      Known to work|                            |4.5.0 4.5.1 4.6.0
         Resolution|                            |WORKSFORME


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-05-29  9:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-29  7:41 [Bug c++/44320] New: ADL names are looked up in namespaces that are only referenced by template arguments sstrasser at systemhaus-gruppe dot de
2010-05-29  7:45 ` [Bug c++/44320] " sstrasser at systemhaus-gruppe dot de
2010-05-29  9:31 ` paolo dot carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).