[Issue 9810] New: Fact that type tuples contain not only tupes isn't documentated
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Mar 24 23:26:47 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9810
Summary: Fact that type tuples contain not only tupes isn't
documentated
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: spec
Severity: normal
Priority: P2
Component: websites
AssignedTo: nobody at puremagic.com
ReportedBy: verylonglogin.reg at gmail.com
--- Comment #0 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2013-03-25 09:26:46 MSK ---
Type tuples and its slices contain also other information which is neither
obvious nor documented:
---
void f(int) { }
void g(ref int) { }
static if(is(typeof(f) Pf == function) && is(typeof(g) Pg == function))
{
// Indexing returns types, everything is clear:
static assert(is(Pf[0] == Pg[0]));
static assert(is(void function(Pf[0]) == void function(Pg[0])));
// This only means corresponding types are equal, not tuples:
static assert(is(Pf == Pg));
// Tuples and its slices are different:
// (Pg contains information that its first type is `ref`)
static assert(!is(void function(Pf) == void function(Pg)));
static assert(!is(void function(Pf[0 .. 1]) == void function(Pg[0 .. 1])));
}
else
static assert(0);
---
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list