Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53083 - trunk/boost/spirit/home/karma/nonterminal
From: hartmut.kaiser_at_[hidden]
Date: 2009-05-18 07:35:35


Author: hkaiser
Date: 2009-05-18 07:35:34 EDT (Mon, 18 May 2009)
New Revision: 53083
URL: http://svn.boost.org/trac/boost/changeset/53083

Log:
Spirit: Added assertion avoiding assigning uninitialized rules.
Text files modified:
   trunk/boost/spirit/home/karma/nonterminal/rule.hpp | 6 ++++++
   1 files changed, 6 insertions(+), 0 deletions(-)

Modified: trunk/boost/spirit/home/karma/nonterminal/rule.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/nonterminal/rule.hpp (original)
+++ trunk/boost/spirit/home/karma/nonterminal/rule.hpp 2009-05-18 07:35:34 EDT (Mon, 18 May 2009)
@@ -186,6 +186,12 @@
 
         rule& operator=(rule const& rhs)
         {
+ // The following assertion fires when you try to initialize a rule
+ // from an uninitialized one. Did you mean to refer to the right
+ // hand side rule instead of assigning from it? In this case you
+ // should write lhs = rhs.alias();
+ BOOST_ASSERT(rhs.f);
+
             f = rhs.f;
             name_ = rhs.name_;
             return *this;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk