[Bug c++/13942] New: Accepts call to nonexistent operator () without -funit-at-a-time.

mattyt-bugzilla at tpg dot com dot au gcc-bugzilla@gcc.gnu.org
Sat Jan 31 11:50:00 GMT 2004


The following code:

struct A {};

template < class TP > struct B {
  virtual void method () {
    A a;
    a(TP(), TP());
  }
  virtual ~B() {}
};

struct E {};

struct C {
  B< E > x;
  virtual ~C () {}
};

is accepted by 3.2, 3.3 and 3.4 (-c).  It's only rejected by -funit-at-a-time with:

error: no match for call to `(A) (E, E)'

as I would have expected.

It's not suprising 3.2 and 3.3 accept the code, as the method is not
instantiated in this example, but 3.4 I would have expected to reject the code
always.

Best as I can tell, it shouldn't work, I don't think there's any need to wait
for instantiation time for Koenig lookup as I imagine the variable "a" would
shadow any resulting function that it would find.

-- 
           Summary: Accepts call to nonexistent operator () without -funit-
                    at-a-time.
           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=13942



More information about the Gcc-bugs mailing list