Bug 66161 - gcc silent about type incompleteness in error message
Summary: gcc silent about type incompleteness in error message
Status: RESOLVED DUPLICATE of bug 13981
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.9.2
: P3 normal
Target Milestone: 5.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-15 14:32 UTC by Tom Tromey
Modified: 2015-05-15 15:32 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Tromey 2015-05-15 14:32:42 UTC
This source is distilled from a more complicated real-world
case that arose in https://bugzilla.mozilla.org/show_bug.cgi?id=1165184

class Base { };

class Incomplete; // : public Base

template<typename T>
Base* blah_cast(T *arg) { return arg; }

Base* function(Incomplete *arg)
{
  return blah_cast(arg);
}


Compiling this yields:

pokyo. g++ -c s.cc
s.cc: In instantiation of ‘Base* blah_cast(T*) [with T = Incomplete]’:
s.cc:10:23:   required from here
s.cc:6:34: error: cannot convert ‘Incomplete*’ to ‘Base*’ in return
 Base* blah_cast(T *arg) { return arg; }
                                  ^


In this case it is obvious that Incomplete is an incomplete type.
However, in the real-world code this is far from obvious.

I think it would be handy if gcc printed something like
"note: type 'Incomplete' is incomplete at this point; missing include?".
Comment 1 Jonathan Wakely 2015-05-15 15:32:06 UTC
This is fixed in 5.1

*** This bug has been marked as a duplicate of bug 13981 ***