C++ Logo


Advanced search

Subject: Re: Legal? Incomplete type "gains" base class on completion.
From: Thiago Macieira (thiago_at_[hidden])
Date: 2019-05-13 10:15:21

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

STD-DISCUSSION list run by herb.sutter at gmail.com

Older Archives on Google Groups