This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/66161] New: gcc silent about type incompleteness in error message
- From: "tromey at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 15 May 2015 14:32:42 +0000
- Subject: [Bug c++/66161] New: gcc silent about type incompleteness in error message
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66161
Bug ID: 66161
Summary: gcc silent about type incompleteness in error message
Product: gcc
Version: 4.9.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tromey at gcc dot gnu.org
Target Milestone: ---
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?".