Boost logo

Boost Users :

From: Jeff Garland (jeff_at_[hidden])
Date: 2005-01-26 08:30:28

On Wed, 26 Jan 2005 11:08:31 +0000, Stephen Jackson wrote
> On Wed, 2005-01-26 at 03:58, Stuart Siegel wrote:
> > Can anyone tell me why the line:
> >
> > time_period t4(t2);
> >
> > in the attached cpp file doesn't compile but the line:
> >
> > time_period t3(t1);
> >
> > does? it seems like i should be calling the same copy constructor in
> > both cases but g++ 3.3.4 complains:
> >
> The difference between the two lines above is this:
> time_period t2( ptime(min_date_time), ptime(max_date_time) );
> g++ is taking this as a function declaration. (I don't know whether
> it should be doing so but it is.) Therefore

Yeah, you are correct it is treating it as a function declaration. This feel
like a gcc bug to me, but there could be some obscure reason why it's that way
that I'm unaware of. Apparently the use of temporary objects is the what
confuses it since

 time_period t1( tmin, tmax );

works just fine.

> N.B. This fix compiles with boost 1.32.0, but not with boost 1.31.0.
> (g++ 3.3.3)

That's because there was a bug in 1.31 that did not allow ptime to construct
special values (constructor was missing). More on the 1.31 to 1.32 changes is
documented in:

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at