public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52647] New: Method from global namespace not selected in anonymous namespace when an overload of said method already exists in the anonymous namespace
@ 2012-03-21  1:59 ntvdm at hotmail dot com
  2012-03-21  3:52 ` [Bug c++/52647] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: ntvdm at hotmail dot com @ 2012-03-21  1:59 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52647
           Summary: Method from global namespace not selected in anonymous
                    namespace when an overload of said method already
                    exists in the anonymous namespace
    Classification: Unclassified
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ntvdm@hotmail.com


In gcc 3.4, 4.1 and 4.3 attempting to compile (e.g. g++43 -c):

  void foo(char) {}
  namespace { void foo(void*) {} }
  namespace { void bar() { foo('x'); } }

...yields:

  /tmp/yy.cpp: In function ‘void<unnamed>::bar()’:
  /tmp/yy.cpp:3: error: invalid conversion from ‘char’ to ‘void*’
  /tmp/yy.cpp:3: error:   initializing argument 1 of
‘void<unnamed>::foo(void*)’

...whereas attempting to compile:

  void foo(char) {}
  namespace anon { void foo(void*) {} }
  using namespace anon;
  namespace { void bar() { foo('x'); } }

...succeeds.  Is this the desired behaviour?

g++43 (GCC) 4.3.2 20081007 (Red Hat 4.3.2-7)
Copyright (C) 2008 Free Software Foundation, Inc.


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

* [Bug c++/52647] Method from global namespace not selected in anonymous namespace when an overload of said method already exists in the anonymous namespace
  2012-03-21  1:59 [Bug c++/52647] New: Method from global namespace not selected in anonymous namespace when an overload of said method already exists in the anonymous namespace ntvdm at hotmail dot com
@ 2012-03-21  3:52 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-03-21  3:52 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-03-21 01:59:17 UTC ---
This is correct.  The behavior can be seen with:
  void foo(char) {}
  namespace anon { void foo(void*) {} }
  using namespace anon;
  namespace anon { void bar() { foo('x'); } }

foo in the anon namespace is only foo as ::foo is hidden and char does not have
a namespace associated with it for ADL.


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

end of thread, other threads:[~2012-03-21  1:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-21  1:59 [Bug c++/52647] New: Method from global namespace not selected in anonymous namespace when an overload of said method already exists in the anonymous namespace ntvdm at hotmail dot com
2012-03-21  3:52 ` [Bug c++/52647] " pinskia at gcc dot gnu.org

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).