This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]