Thread overview | ||||||
---|---|---|---|---|---|---|
|
March 10, 2009 [Issue 2725] New: Pattern matching in static if not working with variadic arguments | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2725 Summary: Pattern matching in static if not working with variadic arguments Product: D Version: unspecified Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: andrei@metalanguage.com struct A(B...) {} void main() { alias A!(int, float) X; static if (!is(X Y == A!(Z), Z)) { static assert(false); } } This example fails the static assert. If one removes the float in the instantiation of A the example compiles. The compiler should match Z to the type tuple (int, float). Otherwise it is impossible to detect whether a type is an instantiation of a variadic template. -- |
March 13, 2009 [Issue 2725] Pattern matching in static if not working with variadic arguments | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2725 ------- Comment #1 from bugzilla@digitalmars.com 2009-03-13 16:40 ------- The is expression needs to be written as: static if (!is(X Y == A!(Z), Z...)) with the addition of the ... to indicate that Z is a tuple parameter. It still won't compile right, though, so I'll fix it. -- |
March 13, 2009 Re: [Issue 2725] Pattern matching in static if not working with variadic arguments | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | On Fri, 13 Mar 2009 21:40:29 +0000 (UTC), d-bugmail@puremagic.com wrote: > static if (!is(X Y == A!(Z), Z...)) BTW, this is the sort of thing that my "ASCII version of APL" was referring to. There is no 'intuitive' way to make any sense of that code phrase. I can't even workout how to say it out loud, as in translate it into English. -- Derek Parnell Melbourne, Australia skype: derek.j.parnell |
April 01, 2009 [Issue 2725] Pattern matching in static if not working with variadic arguments | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2725 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #2 from bugzilla@digitalmars.com 2009-04-01 13:54 ------- Fixed DMD 2.027 -- |
Copyright © 1999-2021 by the D Language Foundation