Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2005-07-28 17:05:12


From: Jason Hise <chaos_at_[hidden]>
> Michael Goldshteyn wrote:
>
> >What is:
> >
> >namespace boost
> >{
> > const class
> > {
> >
> >???
> >
> It worked with VC, but I just checked it with comeau and it failed to
> compile. To fix it, I had to provide a name for the class and an
> explicit default constructor. Naming the class null works, because then
> the class name is hidden by the global variable name and thus other
> instances of type null cannot be declared. Updated code:

That may cause grief to those using the -Wshadow option of recent
vintage GCC's.

> namespace boost
> {
> const class null
> {
[snip]
> } null;
> }

According to the grammar, Comeau is wrong:

   class-specifier:
      class-head { member-specification(opt) }

   class-head:
      class-key identifier(opt) base-clause(opt)
      class-key nested-name-specifier identifier base-clause(opt)
      class-key nested-name-specifier(opt) template-id base-clause(opt)

   class-key:
      class
      struct
      union

Note that "identifier" is optional.

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

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