From 827c65b5e90ad05a2ee5c9e0e2e434a2a5cb8fb2 Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Tue, 1 Oct 2013 17:56:10 -0700 Subject: [PATCH] feat(kernel): add static_assert for update_metavar Signed-off-by: Leonardo de Moura --- src/kernel/expr.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/kernel/expr.h b/src/kernel/expr.h index 589982c8b..374d74153 100644 --- a/src/kernel/expr.h +++ b/src/kernel/expr.h @@ -587,6 +587,8 @@ template expr update_eq(expr const & e, F f) { return e; } template expr update_metavar(expr const & e, name const & n, F f) { + static_assert(std::is_same::type, local_entry>::value, + "update_metavar: return type of f(local_entry) is not local_entry"); buffer new_entries; bool modified = n != metavar_name(e); for (local_entry const & me : metavar_lctx(e)) { @@ -607,6 +609,8 @@ template expr update_metavar(expr const & e, name const & n, F f) { return e; } template expr update_metavar(expr const & e, F f) { + static_assert(std::is_same::type, local_entry>::value, + "update_metavar: return type of f(local_entry) is not local_entry"); return update_metavar(e, metavar_name(e), f); } inline expr update_metavar(expr const & e, local_context const & lctx) {