11786 – [3.3/3.4 regression] operator() call on variable in other namespace not recognized (original) (raw)
GCC rejects the following valid code:
struct S { template void operator() (T) {} };
namespace N { S s; struct A {} a; }
using N::s;
void f () { s(N::a); }
GCC says:
t.cpp:8: error: N::s' is not a function, t.cpp:8: error: conflict with N::s'
t.cpp:14: error: in call to `s'
My best guess would be that GCC does not recognize s(..) as a call to operator() on variable N::s, and as such insists on finding a function named 'N::s'. I haven't got a clue as to what the rest of the error message indicates or how A is involved.
Comeau compiles the code without problems.
I'm using GCC 3.4 20030723.
Comment 1 Eelis 2003-08-04 07:28:00 UTC
Simplified snippet:
namespace N { struct A {}; struct S { void operator() (A); } s; }
using N::s;
void f () { s(N::A()); }
Comment 2 Drea Pinski 2003-08-04 19:46:42 UTC
I can confirm this on the mainline (20030804). ICC 6.0 in strict mode (-Xc) accepts this code.
Comment 3 Volker Reichelt 2003-08-04 23:02:14 UTC
gcc 2.95.x compiled the code. It is rejected since gcc 3.0.
Comment 6 Mark Mitchell 2003-09-08 19:15:32 UTC
Fixed in GCC 3.3.2, GCC 3.4.