Boost logo

Boost :

Subject: Re: [boost] [chrono/date] name of getters - error: changes meaning of
From: Vicente Botet (vicente.botet_at_[hidden])
Date: 2013-05-13 12:06:21


Vicente Botet wrote
> Hi,
>
> Naming the getters with the same name as the type
>
> chrono::year year() const;
>
> results in a lot of error with gcc <= 4.8.0
>
> ../../../boost/chrono/date/ymd_date.hpp:267:7: erreur: declaration of
> ‘boost::chrono::year boost::chrono::ymd_date::year() const’ [-fpermissive]
> ../../../boost/chrono/date/year.hpp:36:11: error: changes meaning of
> ‘year’ from ‘class boost::chrono::year’ [-fpermissive]
>
> When I add -fpermissive I get yet the warning
>
> ../../../boost/chrono/date/year.hpp:36:11: attention : changes meaning
> of ‘year’ from ‘class boost::chrono::year’ [-fpermissive]
>
> Do someone how to get ride of this warning/spam?
>
> In addition, no way to make it working with gcc-4.2.1.
>
> No issue with clang-3.1, 3.2.
> Not checked with msvc.
>
> Is this a bug on gcc?

Hi,

To solve these issues, I have been forced to replace the accessors dt.year()
by conversion year(dt).

This has the advantage of making uniform the unit specifier syntax. E.g

date dt;
...
date dt2(year(dt), month(dt), day(13));

Best,
Vicente

--
View this message in context: http://boost.2283326.n4.nabble.com/chrono-date-name-of-getters-error-changes-meaning-of-tp4646800p4647224.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

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