$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r56213 - in trunk/boost/spirit/home: karma/nonterminal qi/nonterminal
From: hartmut.kaiser_at_[hidden]
Date: 2009-09-15 08:18:12
Author: hkaiser
Date: 2009-09-15 08:18:11 EDT (Tue, 15 Sep 2009)
New Revision: 56213
URL: http://svn.boost.org/trac/boost/changeset/56213
Log:
Spirit: fixing segfault if start rule of a grammar is not compatible with the grammar itself
Text files modified: 
   trunk/boost/spirit/home/karma/nonterminal/grammar.hpp |    13 +++++++++++++                           
   trunk/boost/spirit/home/qi/nonterminal/grammar.hpp    |    14 ++++++++++++++                          
   2 files changed, 27 insertions(+), 0 deletions(-)
Modified: trunk/boost/spirit/home/karma/nonterminal/grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/nonterminal/grammar.hpp	(original)
+++ trunk/boost/spirit/home/karma/nonterminal/grammar.hpp	2009-09-15 08:18:11 EDT (Tue, 15 Sep 2009)
@@ -58,6 +58,19 @@
           , name_(name_)
         {}
 
+        // This constructor is used to catch if the start rule is not 
+        // compatible with the grammar. 
+        template <typename Iterator_, typename T1_, typename T2_, typename T3_>
+        grammar(rule<Iterator_, T1_, T2_, T3_> const&
+              , std::string const& = "unnamed-grammar")
+        {
+            // If you see the assertion below failing then the start rule 
+            // passed to the constructor of the grammar is not compatible with 
+            // the grammar (i.e. it uses different template parameters).
+            BOOST_SPIRIT_ASSERT_MSG(false, incompatible_start_rule, 
+                (rule<Iterator_, T1_, T2_, T3_>));
+        }
+
         std::string name() const
         {
             return name_;
Modified: trunk/boost/spirit/home/qi/nonterminal/grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/nonterminal/grammar.hpp	(original)
+++ trunk/boost/spirit/home/qi/nonterminal/grammar.hpp	2009-09-15 08:18:11 EDT (Tue, 15 Sep 2009)
@@ -54,6 +54,20 @@
         , name_(name_)
         {}
 
+        // This constructor is used to catch if the start rule is not 
+        // compatible with the grammar. 
+        template <typename Iterator_, typename T1_, typename T2_, typename T3_>
+        grammar(
+            rule<Iterator_, T1_, T2_, T3_> const&
+          , std::string const& = "unnamed-grammar")
+        {
+            // If you see the assertion below failing then the start rule 
+            // passed to the constructor of the grammar is not compatible with 
+            // the grammar (i.e. it uses different template parameters).
+            BOOST_SPIRIT_ASSERT_MSG(false, incompatible_start_rule, 
+                (rule<Iterator_, T1_, T2_, T3_>));
+        }
+
         std::string name() const
         {
             return name_;