Boost logo

Boost :

From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2003-08-13 00:15:28

[Dave Abrahams]
> If I don't hear of any new problems with the RC_1_30_0 branch I'm
> going to release 1.30.2 tomorrow (Wed) evening or Thursday morning.

There's one little problem... it doesn't compile cleanly under -Wshadow with
gcc. This is annoying because it forces the user to:

1. Hack the headers to eliminate the warning (ugh, even if it's trivial)

If the headers are unhackable (e.g. someone else is root), then:

2. Mentally ignore the warning (ugh)
3. Stop using the warning (ugh)

The offending part is line 24 of boost/date_time/date_duration.hpp. Which

    explicit date_duration(duration_rep days) : days_(days) {};

This causes problems because the very next line defines a function
identically named to that duration_rep argument:

    duration_rep days() const

gcc complains:

warning: declaration of `days' shadows a member of `this'

The fix is trivial: change the occurrences of "days" in line 24 to "d".
days_ of course should not be modified.

There are presumably other -Wshadow problems elsewhere in Boost, but this is
the only one that has affected my code so far.

Stephan T. Lavavej

Boost list run by bdawes at, gregod at, cpdaniel at, john at