[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#195468: g++-3.3: default construction fails when no explicit default constructor defined



On Fri, May 30, 2003 at 09:26:32PM +0200, Herbert Valerio Riedel wrote:
> $ cat static_var.cc
> 
> class bar {
> public:
>   int operator()(int i) { return i; }
>   //bar (void) {} // default constructor
> };
> 
> const bar b = bar (); // works always...
> const bar b2; // fails if there is no explicit default constructor
> $ g++ -c -O0 -Wall static_var.cc
> static_var.cc:9: uninitialized const `b2'
> $
> 
> if the commented out default constructor is enabled, compilation
> succeeds...

Or if you declare b2 as non-const.  This is not a bug.

-- 
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace.  We seek
not your counsel, nor your arms.  Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen.            - Samuel Adams



Reply to: