This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/54055] spurious(?) "invalid use of incomplete type" warning in template definition


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> {
};


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]