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++/14360] New: Failure to compile when variables shadow functions.


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


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