
Dave Jenkins wrote:
"Eric Niebler"
wrote in message news:49807DB5.2080307@boost-consulting.com... You're passing an expression to a grammar to be evaluated with its transforms. That expression must match the grammar. It's undefined behavior if it doesn't, and in this case, it doesn't. "Performing the transform" falls withing UB.
It would be possible to add a compile-time check to all grammars function call operators to catch this error, but that comes with a compile-time cost.
I think it would be a useful check. Could you either (1) always check in proto::exact
That would essentially involve a full evaluation.
(2) check when a compile time flag is defined
That is not a half-bad suggestion. It's funny that we have NDEBUG to avoid costly runtime checks but no equivalent for costly compile-time checks. I've never particularly cared for the "N" in "NDEBUG" ... it seems the wrong default. Perhaps we can have a boost-wide macro for expensive compile-time checks. How about BOOST_COMPILE_TIME_DEBUG? -- Eric Niebler BoostPro Computing http://www.boostpro.com