[Bug c++/14360] New: Failure to compile when variables shadow functions.

mattyt-bugzilla at tpg dot com dot au gcc-bugzilla@gcc.gnu.org
Mon Mar 1 09:36:00 GMT 2004


The following code:

namespace ns {
  struct A {
    void operator() (A *);
    A (int);
  };
  A m ();
}

struct B {
  B() {
    ns::A m (0);
    m ((ns::A *)0);
  }
};

gives errors under G++-3.4:

new25.C: In constructor `B::B()':
new25.C:11: error: `m' is not a function,
new25.C:6: error:   conflict with `ns::A ns::m()'
new25.C:12: error:   in call to `m'

whereas it compiles with g++-3.3 -c.  I would expect the m variable to shadow
the m function, so it would compile.

-- 
           Summary: Failure to compile when variables shadow functions.
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mattyt-bugzilla at tpg dot com dot au
                CC: gcc-bugs at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list