From 08304da099d0e162088a6c0f2eae61d03f64ec8d Mon Sep 17 00:00:00 2001
From: Philip Taylor <philip@zaynar.co.uk>
Date: Tue, 20 Jan 2015 23:16:07 +0000
Subject: [PATCH 05/13] cppformat: Remove support for CUSTOM types.
These cause a lot of type-safety trouble - unsupported types passed into fmt::sprintf (like CStr or enums) will be accepted at compile time, but trigger an exception at runtime. Remove them, so we'll get either an implicit conversion to a supported type, or a compile-time error.
---
source/third_party/cppformat/format.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/source/third_party/cppformat/format.h b/source/third_party/cppformat/format.h
index b3c93eb..01452d0 100644
a
|
b
|
public:
|
706 | 706 | MakeArg(void *value) { type = POINTER; pointer_value = value; } |
707 | 707 | MakeArg(const void *value) { type = POINTER; pointer_value = value; } |
708 | 708 | |
| 709 | #if 0 |
| 710 | // WFG: Removed this because otherwise you can pass a CStr8 or an enum etc |
| 711 | // into fmt::sprintf, and it will be interpreted as a CUSTOM type and then |
| 712 | // will throw an exception at runtime, which is terrible behaviour. |
709 | 713 | template <typename T> |
710 | 714 | MakeArg(const T &value) { |
711 | 715 | type = CUSTOM; |
712 | 716 | custom.value = &value; |
713 | 717 | custom.format = &format_custom_arg<T>; |
714 | 718 | } |
| 719 | #endif |
715 | 720 | }; |
716 | 721 | |
717 | 722 | #define FMT_DISPATCH(call) static_cast<Impl*>(this)->call |