This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/54055] spurious(?) "invalid use of incomplete type" warning in template definition
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 20 Jul 2012 19:26:28 +0000
- Subject: [Bug c++/54055] spurious(?) "invalid use of incomplete type" warning in template definition
- Auto-submitted: auto-generated
- References: <bug-54055-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54055
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-07-20 19:26:28 UTC ---
The code is IMHO invalid, and apparently EDG compilers reject it.
[class.derived] says "The type denoted by a base-type-specifier shall be a
class type that is not an incompletely defined class (Clause 9)" and scoped_ptr
is not complete until the end of its definition.
Jason asked about exactly this situation on the c++ core reflector 3 days ago,
so I assume he changed it intentionally, or at least is aware of it.
You can make the code portable (whatever the resolution of the core issue) by
moving the definition of scoped_ptr::Rvalue to a point where scoped_ptr is
complete:
template<class C>
struct scoped_ptr {
struct RValue; // declare
};
// define
template<class C>
struct scoped_ptr<C>::Rvalue : scoped_ptr<C> {
};