Index: boost/spirit/home/karma/char/char.hpp =================================================================== --- boost/spirit/home/karma/char/char.hpp (revision 83775) +++ boost/spirit/home/karma/char/char.hpp (working copy) @@ -137,7 +137,7 @@ // providing any attribute, as the generator doesn't 'know' what // character to output. The following assertion fires if this // situation is detected in your code. - BOOST_SPIRIT_ASSERT_MSG(false, char_not_usable_without_attribute, ()); + BOOST_SPIRIT_ASSERT_FAIL(CharParam, char_not_usable_without_attribute, ()); return false; } @@ -230,11 +230,11 @@ template bool test(unused_type, CharParam&, Context&) const { - // It is not possible (doesn't make sense) to use char_ generators - // without providing any attribute, as the generator doesn't 'know' + // It is not possible (doesn't make sense) to use char_ generators + // without providing any attribute, as the generator doesn't 'know' // what to output. The following assertion fires if this situation // is detected in your code. - BOOST_SPIRIT_ASSERT_MSG(false + BOOST_SPIRIT_ASSERT_FAIL(CharParam , char_range_not_usable_without_attribute, ()); return false; } @@ -316,11 +316,11 @@ template bool test(unused_type, CharParam&, Context&) const { - // It is not possible (doesn't make sense) to use char_ generators - // without providing any attribute, as the generator doesn't 'know' + // It is not possible (doesn't make sense) to use char_ generators + // without providing any attribute, as the generator doesn't 'know' // what to output. The following assertion fires if this situation // is detected in your code. - BOOST_SPIRIT_ASSERT_MSG(false + BOOST_SPIRIT_ASSERT_FAIL(CharParam , char_set_not_usable_without_attribute, ()); return false; } Index: boost/spirit/home/karma/char/char_class.hpp =================================================================== --- boost/spirit/home/karma/char/char_class.hpp (revision 83775) +++ boost/spirit/home/karma/char/char_class.hpp (working copy) @@ -95,11 +95,11 @@ template bool test(unused_type, CharParam&, Context&) const { - // It is not possible (doesn't make sense) to use char_ generators - // without providing any attribute, as the generator doesn't 'know' + // It is not possible (doesn't make sense) to use char_ generators + // without providing any attribute, as the generator doesn't 'know' // what to output. The following assertion fires if this situation // is detected in your code. - BOOST_SPIRIT_ASSERT_MSG(false + BOOST_SPIRIT_ASSERT_FAIL(CharParam , char_class_not_usable_without_attribute, ()); return false; } Index: boost/spirit/home/karma/numeric/real.hpp =================================================================== --- boost/spirit/home/karma/numeric/real.hpp (revision 83775) +++ boost/spirit/home/karma/numeric/real.hpp (working copy) @@ -203,7 +203,8 @@ // without providing any attribute, as the generator doesn't 'know' // what to output. The following assertion fires if this situation // is detected in your code. - BOOST_SPIRIT_ASSERT_MSG(false, real_not_usable_without_attribute, ()); return false; + BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, real_not_usable_without_attribute, ()); + return false; } template Index: boost/spirit/home/karma/numeric/int.hpp =================================================================== --- boost/spirit/home/karma/numeric/int.hpp (revision 83775) +++ boost/spirit/home/karma/numeric/int.hpp (working copy) @@ -252,7 +252,7 @@ // without providing any attribute, as the generator doesn't 'know' // what to output. The following assertion fires if this situation // is detected in your code. - BOOST_SPIRIT_ASSERT_MSG(false, int_not_usable_without_attribute, ()); + BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, int_not_usable_without_attribute, ()); return false; } Index: boost/spirit/home/karma/numeric/bool.hpp =================================================================== --- boost/spirit/home/karma/numeric/bool.hpp (revision 83775) +++ boost/spirit/home/karma/numeric/bool.hpp (working copy) @@ -171,7 +171,7 @@ // without providing any attribute, as the generator doesn't 'know' // what to output. The following assertion fires if this situation // is detected in your code. - BOOST_SPIRIT_ASSERT_MSG(false, bool_not_usable_without_attribute, ()); + BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, bool_not_usable_without_attribute, ()); return false; } Index: boost/spirit/home/karma/numeric/uint.hpp =================================================================== --- boost/spirit/home/karma/numeric/uint.hpp (revision 83775) +++ boost/spirit/home/karma/numeric/uint.hpp (working copy) @@ -287,7 +287,7 @@ // without providing any attribute, as the generator doesn't 'know' // what to output. The following assertion fires if this situation // is detected in your code. - BOOST_SPIRIT_ASSERT_MSG(false, uint_not_usable_without_attribute, ()); + BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, uint_not_usable_without_attribute, ()); return false; } Index: boost/spirit/home/karma/string/lit.hpp =================================================================== --- boost/spirit/home/karma/string/lit.hpp (revision 83775) +++ boost/spirit/home/karma/string/lit.hpp (working copy) @@ -127,7 +127,7 @@ // providing any attribute, as the generator doesn't 'know' what // character to output. The following assertion fires if this // situation is detected in your code. - BOOST_SPIRIT_ASSERT_MSG(false, string_not_usable_without_attribute, ()); + BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, string_not_usable_without_attribute, ()); return false; } Index: boost/spirit/home/karma/binary/binary.hpp =================================================================== --- boost/spirit/home/karma/binary/binary.hpp (revision 83775) +++ boost/spirit/home/karma/binary/binary.hpp (working copy) @@ -280,7 +280,7 @@ // without providing any attribute, as the generator doesn't 'know' // what to output. The following assertion fires if this situation // is detected in your code. - BOOST_SPIRIT_ASSERT_MSG(false, + BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, binary_generator_not_usable_without_attribute, ()); return false; } Index: boost/spirit/home/karma/stream/stream.hpp =================================================================== --- boost/spirit/home/karma/stream/stream.hpp (revision 83775) +++ boost/spirit/home/karma/stream/stream.hpp (working copy) @@ -192,11 +192,11 @@ static bool generate(OutputIterator&, Context&, Delimiter const&, unused_type) { - // It is not possible (doesn't make sense) to use stream generators - // without providing any attribute, as the generator doesn't 'know' + // It is not possible (doesn't make sense) to use stream generators + // without providing any attribute, as the generator doesn't 'know' // what to output. The following assertion fires if this situation // is detected in your code. - BOOST_SPIRIT_ASSERT_MSG(false, stream_not_usable_without_attribute, ()); + BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, stream_not_usable_without_attribute, ()); return false; } Index: boost/spirit/home/karma/auto/auto.hpp =================================================================== --- boost/spirit/home/karma/auto/auto.hpp (revision 83775) +++ boost/spirit/home/karma/auto/auto.hpp (working copy) @@ -90,7 +90,7 @@ // without providing any attribute, as the generator doesn't 'know' // what to output. The following assertion fires if this situation // is detected in your code. - BOOST_SPIRIT_ASSERT_MSG(false, auto_not_usable_without_attribute, ()); + BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, auto_not_usable_without_attribute, ()); return false; } Index: boost/spirit/home/support/assert_msg.hpp =================================================================== --- boost/spirit/home/support/assert_msg.hpp (revision 83775) +++ boost/spirit/home/support/assert_msg.hpp (working copy) @@ -33,8 +33,19 @@ #define BOOST_SPIRIT_ASSERT_MATCH(Domain, Expr) \ BOOST_SPIRIT_ASSERT_MSG(( \ - boost::spirit::traits::matches::value \ + boost::spirit::traits::matches< Domain, Expr >::value \ ), error_invalid_expression, (Expr)) +// GCC 4.7 will overeagerly instantiate static_asserts in template functions, if the assert condition +// does not depend on template parameters (see https://svn.boost.org/trac/boost/ticket/8381). +// There are places where we want to use constant false as the condition in template functions +// to indicate that these function overloads should never be called. This allows to generate +// better error messages. To solve this problem we make the condition dependent on the template argument +// and use the following macro in such places. +#include + +#define BOOST_SPIRIT_ASSERT_FAIL(TemplateParam, Msg, Types) \ + BOOST_SPIRIT_ASSERT_MSG((!boost::is_same< TemplateParam, TemplateParam >::value), Msg, Types) + #endif Index: boost/spirit/repository/home/qi/nonterminal/subrule.hpp =================================================================== --- boost/spirit/repository/home/qi/nonterminal/subrule.hpp (revision 83775) +++ boost/spirit/repository/home/qi/nonterminal/subrule.hpp (working copy) @@ -529,7 +529,7 @@ { // If you are seeing a compilation error here, you are trying // to use a subrule as a parser outside of a subrule group. - BOOST_SPIRIT_ASSERT_MSG(false + BOOST_SPIRIT_ASSERT_FAIL(Iterator , subrule_used_outside_subrule_group, (id_type)); return false; @@ -558,7 +558,7 @@ { // If you are seeing a compilation error here, you are trying // to use a subrule as a parser outside of a subrule group. - BOOST_SPIRIT_ASSERT_MSG(false + BOOST_SPIRIT_ASSERT_FAIL(Iterator , subrule_used_outside_subrule_group, (id_type)); return false; Index: boost/spirit/repository/home/karma/nonterminal/subrule.hpp =================================================================== --- boost/spirit/repository/home/karma/nonterminal/subrule.hpp (revision 83775) +++ boost/spirit/repository/home/karma/nonterminal/subrule.hpp (working copy) @@ -503,7 +503,7 @@ { // If you are seeing a compilation error here, you are trying // to use a subrule as a generator outside of a subrule group. - BOOST_SPIRIT_ASSERT_MSG(false + BOOST_SPIRIT_ASSERT_FAIL(OutputIterator , subrule_used_outside_subrule_group, (id_type)); return false; @@ -532,7 +532,7 @@ { // If you are seeing a compilation error here, you are trying // to use a subrule as a generator outside of a subrule group. - BOOST_SPIRIT_ASSERT_MSG(false + BOOST_SPIRIT_ASSERT_FAIL(OutputIterator , subrule_used_outside_subrule_group, (id_type)); return false;