C++ Logo


Advanced search

Re: Legal? Incomplete type "gains" base class on completion.

From: Thiago Macieira <thiago_at_[hidden]>
Date: Mon, 13 May 2019 08:15:21 -0700
On Sunday, 12 May 2019 15:27:35 PDT Fabio Fracassi via Std-Discussion wrote:
> No problem. I guess I confused myself over how incomplete classes work
> (I wondered if the forward decl needed to know the base class). I just
> rechecked and found that the forward declaration is indeed just the name
> (the base class cannot be part of the forward decl see [baseic.def]), so
> as you say: it just falls out of the normal rules.

Under regular conditions, according to the standard, you don't need to know
the base class.

With MVSC, if you use ponters to member functions, it's not regular conditions
and it violates the standard. You should not forward-declare your classes or,
if you do, make sure it's complete by the end of the same #include. Or at
least use one of their extensions to indicate what type of PMF you need.

Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel System Software Products

Received on 2019-05-13 10:17:09