From f6d1c5346fc3b950fe31f7f6f920699e9835cb62 Mon Sep 17 00:00:00 2001 From: Sebastien Braun Date: Sun, 10 Oct 2010 14:31:25 +0200 Subject: Fix bug in logical OR when chaining Require<...> Policy. --- src/input/inputEventHandler.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/input/inputEventHandler.h b/src/input/inputEventHandler.h index 3879b80..11e2f4e 100644 --- a/src/input/inputEventHandler.h +++ b/src/input/inputEventHandler.h @@ -102,8 +102,10 @@ template BEGIN_POLICY_CLASS(Require) { static const bool areSystemRequirementsFulfilled = - NextPolicy::areSystemRequirementsFulfilled || - detail::Matches, detail::SystemTraits>::value; + (NextPolicy::areSystemRequirementsFulfilled + && !NextPolicy::areSystemRequirementsVacuouslyFulfilled) + || detail::Matches, detail::SystemTraits>::value; + static const bool areSystemRequirementsVacuouslyFulfilled = false; } END_POLICY_CLASS @@ -158,6 +160,9 @@ struct InputEventHandlerPolicyBase // everywhere static const bool areSystemRequirementsFulfilled = true; + // We need this to implement proper logical OR + static const bool areSystemRequirementsVacuouslyFulfilled = true; + // Generate an error when no match policy is given. bool isApplicable(InputEvent const&) { -- cgit v1.2.3-55-g7522