Opened 13 years ago

Closed 13 years ago

#3556 closed Bugs (fixed)

Missing explicit braces to avoid ambiguous else clause

Reported by: mloskot <mateusz@…> Owned by: Vladimir Prus
Milestone: Boost 1.41.0 Component: program_options
Version: Boost Development Trunk Severity: Cosmetic
Keywords: Cc:

Description

While building Boost from current trunk (r57126) using GCC 4.4.1 I'm getting the following warning for Boost Program Options:

gcc.compile.c++ bin.v2/libs/program_options/build/gcc-4.4.1/release/link-static/threading-multi/options_description.o
libs/program_options/src/options_description.cpp: In member function ‘boost::program_options::option_description::match_result boost::program_options::option_description::match(const std::string&, bool) const’:
libs/program_options/src/options_description.cpp:74: warning: suggest explicit braces to avoid ambiguous ‘else

Patch adding the extra braces attached.

Attachments (1)

program_options-explicit-braces.patch (633 bytes ) - added by mloskot <mateusz@…> 13 years ago.
Patch with missing braces to avoid ambiguous else clause

Download all attachments as: .zip

Change History (3)

by mloskot <mateusz@…>, 13 years ago

Patch with missing braces to avoid ambiguous else clause

comment:1 by mloskot <mateusz@…>, 13 years ago

By the way, one more warning is reported. To not to make too much noise with new ticket, here it is:

libs/program_options/src/value_semantic.cpp:175: warning: suggest parentheses around ‘&&’ within ‘||’
libs/program_options/src/value_semantic.cpp:190: warning: suggest parentheses around ‘&&’ within ‘||

comment:2 by Vladimir Prus, 13 years ago

Resolution: fixed
Status: newclosed

(In [57270]) Fix 'ambiguous else clause' compiler warning. Fixes #3556.

Patch from Mateusz Loskot.

Note: See TracTickets for help on using tickets.