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++/11786] New: operator() call on variable in other namespace not recognized


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: operator() call on variable in other namespace not
                    recognized
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gccbugs at contacts dot eelis dot net
                CC: gcc-bugs at gcc dot gnu dot org

GCC rejects the following valid code:

  struct S
  {
    template <typename T> 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.


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