diff --git a/peglib.h b/peglib.h
index cae4d6d..d59f974 100644
--- a/peglib.h
+++ b/peglib.h
@@ -3138,6 +3138,8 @@ private:
         case Loop::Type::oom: return oom(ope);
         case Loop::Type::rep: // Regex-like repetition
           return rep(ope, loop.range.first, loop.range.second);
+        default:
+          throw std::runtime_error("Unhandled enum constant");
         }
       }
     };