Thread overview | ||||||
---|---|---|---|---|---|---|
|
May 15, 2009 [Issue 2983] New: Elaborate restricted variadic function does not compile | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2983 Summary: Elaborate restricted variadic function does not compile 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 I suspect there are multiple reasons for which the code below does not compile. It should, however, compile and run properly: auto max(T...)(T a) if (T.length == 2 && is(typeof(a[1] > a[0] ? a[1] : a[0])) || T.length > 2 && is(typeof(max(max(a[0], a[1]), a[2 .. $])))) { static if (T.length == 2) { return a[1] > a[0] ? a[1] : a[0]; } else { return max(max(a[0], a[1]), a[2 .. $]); } } void main() { assert(max(4, 5) == 5); assert(max(3, 4, 5) == 5); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 14, 2009 [Issue 2983] Elaborate restricted variadic function does not compile | ||||
---|---|---|---|---|
| ||||
Posted in reply to andrei@metalanguage.com | http://d.puremagic.com/issues/show_bug.cgi?id=2983 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug@yahoo.com.au --- Comment #1 from Don <clugdbug@yahoo.com.au> 2009-10-14 00:09:03 PDT --- This is failing because 'a' isn't available while in the constraint. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 14, 2009 [Issue 2983] Elaborate restricted variadic function does not compile | ||||
---|---|---|---|---|
| ||||
Posted in reply to andrei@metalanguage.com | http://d.puremagic.com/issues/show_bug.cgi?id=2983 --- Comment #2 from Andrei Alexandrescu <andrei@metalanguage.com> 2009-10-14 07:01:38 PDT --- (In reply to comment #1) > This is failing because 'a' isn't available while in the constraint. Exactly. The idea is that making the parameter names available would simplify writing template constraints a lot. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 17, 2009 [Issue 2983] Elaborate restricted variadic function does not compile | ||||
---|---|---|---|---|
| ||||
Posted in reply to andrei@metalanguage.com | http://d.puremagic.com/issues/show_bug.cgi?id=2983 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE --- Comment #3 from Don <clugdbug@yahoo.com.au> 2009-10-16 18:45:01 PDT --- This is fixed by match to bug 3379. *** This issue has been marked as a duplicate of issue 3379 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation