From d73b0b05b254f2041b53f1c4e556c271baa76002 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Thu, 30 Nov 2017 21:53:12 +0100 Subject: [PATCH] Library: attempt to get more explicit type diagnostics ...including the various reference and pointer adornments; typeid() unfortunately strips those, so we'll have to add them manually --- .../library/meta/value-type-binding-test.cpp | 64 ++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/tests/library/meta/value-type-binding-test.cpp b/tests/library/meta/value-type-binding-test.cpp index 5d6ebd1b5..6f3b4a679 100644 --- a/tests/library/meta/value-type-binding-test.cpp +++ b/tests/library/meta/value-type-binding-test.cpp @@ -59,11 +59,64 @@ namespace test{ struct Space { }; using Join = ulong; + template + struct Bugg + { + static_assert (not sizeof(X), "guggi"); + }; + + template + struct TypeDiagnostics + { + using Type = X; + static constexpr auto postfix = ""; + }; + template + struct TypeDiagnostics + { + using Type = X; + static constexpr auto postfix = "&"; + }; + template + struct TypeDiagnostics + { + using Type = X; + static constexpr auto postfix = " &&"; + }; + template + struct TypeDiagnostics + { + using Type = X; + static constexpr auto postfix = " const&"; + }; + template + struct TypeDiagnostics + { + using Type = X; + static constexpr auto postfix = " const &&"; + }; + template + struct TypeDiagnostics + { + using Type = X; + static constexpr auto postfix = " *"; + }; + template + struct TypeDiagnostics + { + using Type = X; + static constexpr auto postfix = " * const"; + }; + template inline string showType() { - return humanReadableTypeID (typeid(X).name()); + using Case = TypeDiagnostics; + using Type = typename Case::Type; + + return humanReadableTypeID (typeid(Type).name()) + + Case::postfix; } }//(end)fixture @@ -166,6 +219,15 @@ namespace test{ cout << showType::value_type>() <::reference>() <::pointer>() <() <() <() <() <() <() <() <() <