immutable-arguments(#989): verify the tuple builder can handle those too

incidentally, this uncovered yet another unwanted narrowing conversion,
namely from double via gavl_time_t to TimeValue or alternatively
from double via FSecs (= rational<long>) to Duration.

As in all the previos cases, actually the compiler is to blame,
and GCC-5 is known to get that one right, i.e. let the SFINAE fail
instead of passing it with a "narrowing conversion" warning.



Note: the real test for command binding with immutable types
can be found in BusTerm_test
This commit is contained in:
Fischlurch 2016-02-07 02:20:01 +01:00
parent e0f866092d
commit 2a6e48d7b5
3 changed files with 10 additions and 3 deletions

View file

@ -77,6 +77,10 @@ namespace lib{
namespace hash {
class LuidH;
}
namespace time {
class TimeValue;
class Duration;
}}
namespace proc {
namespace mobject{
@ -385,6 +389,9 @@ namespace meta {
TRAIT_IS_NARROWING (double, float)
TRAIT_IS_NARROWING (double, lib::time::TimeValue)
TRAIT_IS_NARROWING (double, lib::time::Duration)
#undef TRAIT_IS_NARROWING

View file

@ -576,7 +576,7 @@ TEST "tuple initialisation from GenNode" TupleRecordInit_test <<END
out: Rec...GenNode.+DataCap.«string».lalü, GenNode.+DataCap.«int».42
out: Rec...GenNode.+DataCap.«string».lalü, GenNode.+DataCap.«string».lala, GenNode.+DataCap.«int».12, GenNode.+DataCap.«int».34, GenNode.+DataCap.«double».5.6, GenNode.+DataCap.«Time».0:09:08.007
out-lit: «tuple<string, int>»──(lalü,42)
out-lit: «tuple<idi::EntryID<long>, string, int, long, double, TimeVar>»──(ID<long>-lal,lala,12,34,5.6,548s7ms)
out-lit: «tuple<idi::EntryID<long>, string, int, long, double, Duration>»──(ID<long>-lal,lala,12,34,5.6,≺548s7ms≻)
return: 0
END

View file

@ -42,7 +42,7 @@ using lib::diff::GenNode;
using lib::meta::Types;
using lib::meta::Tuple;
using lib::meta::buildTuple;
using lib::time::TimeVar;
using lib::time::Duration;
using lib::time::Time;
using lib::hash::LuidH;
@ -93,7 +93,7 @@ namespace test {
show_simpleUsage()
{
using NiceTypes = Types<string, int>;
using UgglyTypes = Types<EntryID<long>, string, int, int64_t, double, TimeVar>;
using UgglyTypes = Types<EntryID<long>, string, int, int64_t, double, Duration>; // various conversions and an immutable type (Duration)
Rec args = MakeRec().scope("lalü", 42);
Rec urgs = MakeRec().scope("lalü", "lala", 12, 34, 5.6, Time(7,8,9));