[Bug c++/13981] New: Give message about incomplete class that might be implicitly upcasted.

mattyt-bugzilla at tpg dot com dot au gcc-bugzilla@gcc.gnu.org
Mon Feb 2 15:30:00 GMT 2004


The code:

struct A {};
struct B;

void func( A* a );

int main(int argc, char *argv[]) {
	B *b = 0;
	func(b);
};

gives the error message:

upcast.cc: In function `int main(int, char**)':
upcast.cc:8: error: cannot convert `B*' to `A*' for argument `1' to `void func(A*)'

which is correct.

However in other places gcc will tell you when you've tried to do something with
an incomplete type which might have succeeded if it was complete.  It would be
nice if it could do it here, since B might be a subclass of A.

This should be just a simple matter of adding "[B is incomplete]" to the end of
the error message or something.

-- 
           Summary: Give message about incomplete class that might be
                    implicitly upcasted.
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: enhancement
          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=13981



More information about the Gcc-bugs mailing list