Boost logo

Boost :

From: Jonathan Wakely (cow_at_[hidden])
Date: 2004-07-21 09:29:00


On Wed, Jul 21, 2004 at 05:24:37PM +0400, Vladimir Prus wrote:

Hi Volodya, thanks for the reply.

> > WCHAR_MAX is not defined by FreeBSD's wchar.h.
> > Can boost::numeric_limits<wchar_t> be used instead?
>
> Does FreeBSD's wchar.h defines anything similiar? If not, could you indeed
> try using boost::numeric_limits. If it works, I'll make the change in CVS
> and see if this breaks anything else.

No, it doesn't provide anything else, but using numeric_limits works for
me, patch attached (will need testing for other compilers - I've only
tested GCC 3.4 on FreeBSD). I don't think the boost:: qualification
should be there in my patch, but does no harm.

> > The second problem is visible because I built GCC with concept-checks
> > enabled, which means the STL containers use a version of Boost's concept
> > checks. This reveals that boost/program_options/options_description.hpp
> > uses an incomplete type on line 232:
>
> Hmmm.... the boiled down example is:
>
> class options_description {
> std::vector<options_description> groups;
> };
>
> I'm really not sure what's going on there, because the standard does not say
> if instantinating a vector with incomplete type is allowed (or disallowed).
> Further, somehow the main regression tests have no problems.
>
> > This error can be reproduced by compiling with -D_GLIBCXX_CONCEPT_CHECKS,
> > or -D_GLIBCXX_DEBUG. Both the concept-checks and debug mode will reject
> > std::vector< incomplete type >.
>
> For me only _GLIBCXX_CONCEPT_CHECKS triggers the error (on Debian). So the

Your testcase is different to the code that causes the error.
Try this:

    #define _GLIBCXX_DEBUG
    #include <vector>
    class options_description;
    std::vector<options_description> groups;

This fails for me. But, that might be because __gnu_debug::vector
(incorrectly) has stricter requirements than std::vector.

> primary question: is it allowed to instantiate vector with incomplete type?
> If yes, it's a bug in g++, otherwise, it's a bug in program options.

No, I'm pretty sure it's not - although I can't quote the standard right
now. GCC's concept-checks and debug mode both require a complete type.
The debug mode (by Doug Gregor IIRC) fails quite messily for the
testcase above.

jon

-- 
"It is seldom that liberty of any kind is lost all at once."
	- David Hume



Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk