From 841a1fb20c598553a82ad93ac58f2eb125cb38e0 Mon Sep 17 00:00:00 2001 From: Soonho Kong Date: Sat, 28 Sep 2013 17:52:27 -0700 Subject: [PATCH] fix(debug): print type in lean_assert, print bool correctly - use typeinfo to print out a type of value when an assertion fails. need to use "c++filt --types" to demangle names for non-basic types. - use std::boolalpha and std::noboolalpha to control the printed values for "true" and "false" --- src/util/debug.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/util/debug.h b/src/util/debug.h index fa4d1bbde..6929e464d 100644 --- a/src/util/debug.h +++ b/src/util/debug.h @@ -6,6 +6,7 @@ Author: Leonardo de Moura */ #pragma once #include +#include #include "util/exception.h" #ifndef __has_builtin @@ -106,6 +107,9 @@ public: virtual char const * what() const noexcept { return "'unreachable' code was reached"; } }; namespace debug { -template void display_var(char const * name, T const & value) { std::cerr << name << " := " << value << "\n"; } +template void display_var(char const * name, T const & value) { + std::cerr << name << " : " << typeid(value).name() << " := " + << std::boolalpha << value << std::noboolalpha + << std::endl; } } }