Boost logo

Boost Users :

Subject: Re: [Boost-users] Complete vs incomplete (fwd decl'd) types
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-02-12 18:01:23


AMDG

Dominique Devienne wrote:
> In client code including the header for MyDerived, I'm using a
> MyPtr<MyDerived>, but the static assert below was failing. It took me
> a little while to figure out that in myderived.h, the
> MyDerived::nested_type typedef is using a forward-declared
> MyNestedDerived type declared in my_nested_derived.h, that the client
> code was not including, which was the reason is_base_of was failing
> with the error below (Boost 1.41, VC9). Adding a #include
> <my_nested_derived.h> fixed it.
>
> boost\type_traits\is_base_and_derived.hpp(228) : error C2139:
> 'MyNestedDerived' : an undefined class is not allowed as an argument
> to compiler intrinsic type trait '__is_base_of'
>
> But is there a way to get a more obvious error message stating that
> MyNestedDerived is an incomplete type or something? In retrospect the
> message is not that bad, but I'm hoping there's a better way.
>

It seems to me that it's the compiler's job to provide a good error
message in this case. I don't see that there's very much we
can do inside Boost to improve it.

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net