Boost logo

Boost :

Subject: Re: [boost] [optional] Warnings about uninitialized values
From: Adam Romanek (romanek.adam_at_[hidden])
Date: 2014-06-23 02:32:59

On 22.06.2014 00:28, Andrey Semashev wrote:
> Hi,
> When I use boost::optional I often see gcc warnings about using possibly
> uninitialized values. I've seen such warnings in my projects outside Boost but
> now I encountered them in Boost.Log. Building the current develop with gcc 4.8
> I see this:
> (...)
> I suspect this may be a compiler bug. I tried to create a minimal example to
> reproduce it but the warning doesn't show in a simple context. However, I'd
> like it to be worked around somehow (unless it's an actual bug in
> boost::optional).
> Any suggestions? Am I missing a bug in my code?


I'm experiencing the same issue in my code where boost::optional is used
quite extensively.

Some time ago I found a bug report in GCC's Bugzilla [1] and a
StackOverflow thread [2] related to this issue. Additionally, clang
doesn't show any warnings in my code. Hence I assumed this is a bug in GCC.

It turns out that GCC provides a way to silence such warnings
selectively via a #pragma [3]. However, I'm not sure this is the right
way to go.

Adam Romanek


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