Boost C++ Libraries: Ticket #8811: Problem compiling Boost.Log tutorial https://svn.boost.org/trac10/ticket/8811 <p> I am using Boost.Log from Boost 1.54.0 on Fedora 18 using gcc. When I compile the trivial logging with filters tutorial using the compiler options -Wall -Wextra -Werror, it fails to compile. (Note: The generated error messages can be found in the attached file.) It successfully compiles if I add -Wno-missing-field-initializers but I would prefer not having to add that option and have clean compiles. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8811 Trac 1.4.3 lcarreon@… Wed, 10 Jul 2013 23:13:50 GMT attachment set https://svn.boost.org/trac10/ticket/8811 https://svn.boost.org/trac10/ticket/8811 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost_log_problem.txt</span> </li> </ul> <p> Error messages from the compiler </p> Ticket Chris Stylianou <chris5287@…> Thu, 18 Jul 2013 19:58:05 GMT <link>https://svn.boost.org/trac10/ticket/8811#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8811#comment:1</guid> <description> <p> Im also experiencing similar warnings: </p> <pre class="wiki">.../include/boost/log/expressions/formatters/stream.hpp:40:29: warning: missing initializer for member boost::phoenix::actor&lt;boost::proto::exprns_::basic_expr&lt;boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term&lt;boost::phoenix::argument&lt;2&gt; &gt;, 0l&gt; &gt;::proto_expr_ [-Wmissing-field-initializers] const stream_type stream = {}; ^ </pre><pre class="wiki">.../include/boost/log/expressions/keyword.hpp:203:53: warning: missing initializer for member boost::log::v2_mt_posix::expressions::attribute_keyword&lt;boost::log::v2_mt_posix::trivial::tag::severity&gt;::proto_expr_ [-Wmissing-field-initializers] const BOOST_PP_CAT(keyword_, _type) keyword_ = {}; ^ </pre><pre class="wiki">.../include/boost/log/expressions/message.hpp:98:31: warning: missing initializer for member boost::log::v2_mt_posix::expressions::attribute_keyword&lt;boost::log::v2_mt_posix::expressions::tag::message&gt;::proto_expr_ [-Wmissing-field-initializers] const message_type message = {}; ^ </pre><pre class="wiki">.../include/boost/log/expressions/message.hpp:108:33: warning: missing initializer for member boost::log::v2_mt_posix::expressions::attribute_keyword&lt;boost::log::v2_mt_posix::expressions::tag::smessage&gt;::proto_expr_ [-Wmissing-field-initializers] const smessage_type smessage = {}; ^ </pre><pre class="wiki">.../include/boost/log/expressions/message.hpp:119:33: warning: missing initializer for member boost::log::v2_mt_posix::expressions::attribute_keyword&lt;boost::log::v2_mt_posix::expressions::tag::wmessage&gt;::proto_expr_ [-Wmissing-field-initializers] const wmessage_type wmessage = {}; ^ </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Sat, 20 Jul 2013 18:56:01 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/8811#comment:2 https://svn.boost.org/trac10/ticket/8811#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> I do not see how this warning could be worked around. In C++11 it is possible to write: </p> <pre class="wiki">const message_type message = { { {} } }; </pre><p> but in C++03 mode the compiler emits error on this code. Another solution is: </p> <pre class="wiki">const message_type message = { { tag::message() } }; </pre><p> but this is no longer a constant initialization, which technically makes the code that uses keywords invalid. </p> <p> And no matter what I do, I cannot get rid of these warnings: </p> <pre class="wiki">./boost/log/expressions/message.hpp:98:20: error: ‘boost::log::v2s_mt_posix::expressions::message’ defined but not used [-Werror=unused-variable] ./boost/log/expressions/message.hpp:108:21: error: ‘boost::log::v2s_mt_posix::expressions::smessage’ defined but not used [-Werror=unused-variable] ./boost/log/expressions/message.hpp:119:21: error: ‘boost::log::v2s_mt_posix::expressions::wmessage’ defined but not used [-Werror=unused-variable] </pre><p> Bottom line: use more reasonable warning levels with your compiler or at least disable bogus warnings like this. </p> Ticket