digitalmars.D.bugs - [Issue 4333] New: Cannot use tuple of local symbols in constraint nor static if
- d-bugmail puremagic.com (74/74) Jun 16 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4333
- d-bugmail puremagic.com (10/10) May 26 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4333
- d-bugmail puremagic.com (12/12) Jul 10 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4333
- d-bugmail puremagic.com (13/13) Jul 28 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4333
- d-bugmail puremagic.com (7/9) Jul 28 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4333
- d-bugmail puremagic.com (7/7) Jul 28 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4333
- d-bugmail puremagic.com (22/27) Jul 28 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4333
- d-bugmail puremagic.com (15/16) Sep 15 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4333
http://d.puremagic.com/issues/show_bug.cgi?id=4333 Summary: Cannot use tuple of local symbols in constraint nor static if Product: D Version: 2.041 Platform: Other OS/Version: All Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: rsinfu gmail.com --- When a template is instantiated with a tuple of local symbols, using those local symbols in template-constraint and/or static-if causes a compile error. See (1) and (2) below. The error does not occur if the tuple is evaluated outside static-if scope before used in a static if. See (3). (1) Using a tuple containing a local delegate literal in a template contraint causes an error: -------------------- template Test(a...) if (a.length == 1) // <-- !! { } void main() { alias Test!((int a) { return a; }) test; // Error: delegate test.__dgliteral1 cannot access frame of // function __dgliteral1 } -------------------- (2) Using the same tuple in a static if does not compile for the same error: -------------------- template Test(a...) { static if (typeof(a[0]).stringof) {} // <-- !! } void main() { alias Test!((int a) { return a; }) test; // Error: delegate test.__dgliteral1 cannot access frame of // function __dgliteral1 } -------------------- (3) NOTE: The error does not occur if the tuple is evaluated outside static-if scope before used in a static if: -------------------- template Test(a...) { alias typeof(a) at; // evaluated once (error w/o this line) static if (a.length == 1) {} } void main() { alias Test!((int a) { return a; }) test; // ok } -------------------- (4) The error does not occur if the argument is not a tuple: -------------------- template Test(alias a) // not tuple { static if (typeof(a).stringof) {} } void main() { alias Test!((int a) { return a; }) test; // ok } -------------------- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 16 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4333 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich gmail.com 14:13:45 PDT --- I can't reproduce this on 2.053. Can you confirm? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 26 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4333 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |yebblies gmail.com Resolution| |WORKSFORME These all seem to work on dmd2.054 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 10 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4333 Gor Gyolchanyan <gor boloneum.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED CC| |gor boloneum.com Resolution|WORKSFORME | --- No, it still doesn't work. I tried making a template and passing it a tuple of mixed literals and local variable names and the same error occurred. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 28 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4333No, it still doesn't work. I tried making a template and passing it a tuple of mixed literals and local variable names and the same error occurred.Please post a test case if you have one. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 28 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4333 --- Created an attachment (id=1014) A struct, using which causes some problems. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 28 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4333 ---Can't reproduce that problem ATM, but another problem was discovered: Hsec[] test(items...)() { return Hsec(items); } unittest { int i; float f; char c; foreach(z; test!(5, i, 2.3f, f, 'a', c)) { writeln(z.type, " ", z.kind); } } this code causes DMD to crash. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------No, it still doesn't work. I tried making a template and passing it a tuple of mixed literals and local variable names and the same error occurred.Please post a test case if you have one.
Jul 28 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4333 klickverbot <code klickverbot.at> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED CC| |code klickverbot.at Resolution| |WORKSFORME ---Can't reproduce that problem ATM, but another problem was discovered:Just pasting the code from the attachment and your test case works fine here (latest DMD on OS X x86) – please provide more detailed instructions for reproducing the problem. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 15 2011