Boost logo

Boost :

Subject: Re: [boost] [optional] Strict Aliasing Warnings on Trunk
From: Patrick Horgan (phorgan1_at_[hidden])
Date: 2009-12-19 02:21:55

Dean Michael Berris wrote:
> On Sat, Dec 19, 2009 at 5:11 AM, Patrick Horgan <phorgan1_at_[hidden]> wrote:
>> And it's really frustrating too. I use optional from the trunk for simple
>> things in a small test program, and get no warnings at all even in programs
>> where I do stupid programming tricks to get gcc to winge about strict
>> aliasing on other lines so that I know I have the compile options right. I
>> can't get gcc to complain about optional in my program at all, even trying
>> different values of -Wstrict-aliasing, but building boost-trunk I see it.
> Are you using GCC 4.4.1? Because I'm pretty sure having -Wall turned
> on with GCC 4.4 on Boost.Trunk would yield the warning.
Yep, with 4.4.1 and with 4.5 and -Wall, and optimization, or
alternatively with -fstrict-aliasing -Wstrict-aliasing=3 the following
code had no warnings at all with boost-trunk:

#include <boost/optional.hpp>

    return *boost::optional<char>('c');

int main()
    char c;

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