id summary reporter owner description type status milestone component version severity resolution keywords cc 11169 boost::optional triggers -Wmaybe-uninitialized errors in g++ Mathias Stearn Fernando Cacciola "Example taken from StackOverflow question 21755206* {{{ #include ::boost::optional getitem(); int go(int nr) { boost::optional a = getitem(); boost::optional b; if (nr > 0) b = nr; if (a != b) return 1; return 0; } }}} {{{ g++ -c -O2 -Wall /tmp/test.cpp /tmp/test.cpp: In function ‘int go(int)’ /tmp/test.cpp:13:3: warning: ‘*((void*)& b +4)’ may be used uninitialized in this function [-Wmaybe-uninitialized] if (a != b) ^ }}} This has been reported as gcc bug 47679*. Two workarounds that seem to work in my testing are value-initializing dummy_ in the aligned_storage default constructor or adding an empty asm statement that lists dummy_ as an output. Would it be possible to include a fix in mainline boost? * Sorry, but trac flags this as spam if I include direct links." Bugs new To Be Determined optional Boost 1.57.0 Problem