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: [email protected]
ReportedBy: [email protected]
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.