Thread overview | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
July 01, 2011 [Issue 6235] New: Regression(DMD 2.053) ICE on typeof(Range.init[0..$]) inside a templated struct/class | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=6235 Summary: Regression(DMD 2.053) ICE on typeof(Range.init[0..$]) inside a templated struct/class Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Keywords: ice-on-valid-code Severity: regression Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: sandford@jhu.edu --- Comment #0 from Rob Jacques <sandford@jhu.edu> 2011-07-01 13:51:56 PDT --- This is a regression between DMD 2.052 and DMD 2.053. Here is a very reduced test case: struct Bug(Range) { pragma(msg, typeof(Range.init[0..$]) ); } void main(string[] args) { Bug!(ubyte[]) bug; } The issue also effect classes and is statements, i.e. enum useSlicing = is(typeof(Range.init[0..$]) : const ubyte[] ); This problem seems to be limited to the use of a template parameter inside a struct/class defined outside of the current scope. All of the following compile: void main(string[] args) { pragma(msg, typeof((ubyte[]).init[0..$]) ); alias ubyte[] Range; pragma(msg, typeof(Range.init[0..$]) ); struct NotBug(Range2) { pragma(msg, typeof(Range2.init[0..$]) ); } NotBug!(ubyte[]) notBug; } This bug can be worked around by placing the statement inside its own sub-template. I.e: struct Bug(Range) { template UseSlicing(__Range) { enum UseSlicing = is(typeof(__Range.init[0..$]) : const ubyte[] ); } pragma(msg, UseSlicing!Range); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 01, 2011 [Issue 6235] Regression(DMD 2.053) ICE on typeof(Range.init[0..$]) inside a templated struct/class | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rob Jacques | http://d.puremagic.com/issues/show_bug.cgi?id=6235 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug@yahoo.com.au --- Comment #1 from Don <clugdbug@yahoo.com.au> 2011-07-01 14:36:38 PDT --- It's crashing in VoidInitializer::toDt(). Seems that 'type' hasn't been set. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 02, 2011 [Issue 6235] Regression(DMD 2.053) ICE on typeof(Range.init[0..$]) inside a templated struct/class | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rob Jacques | http://d.puremagic.com/issues/show_bug.cgi?id=6235 yebblies <yebblies@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |yebblies@gmail.com --- Comment #2 from yebblies <yebblies@gmail.com> 2011-07-02 15:16:36 EST --- Using $ seems to be adding the declaration to the struct as a field. Is there any reason $ is always a variable, not just re-written as exp[... $ ... ] => exp[... exp.length ...] ? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 03, 2011 [Issue 6235] Regression(DMD 2.053) ICE on typeof(Range.init[0..$]) inside a templated struct/class | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rob Jacques | http://d.puremagic.com/issues/show_bug.cgi?id=6235 --- Comment #3 from Don <clugdbug@yahoo.com.au> 2011-07-03 13:41:49 PDT --- (In reply to comment #2) > Using $ seems to be adding the declaration to the struct as a field. Is there any reason $ is always a variable, not just re-written as exp[... $ ... ] => exp[... exp.length ...] ? I think it's because exp may have side effects, so it should only be evaluated once. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 04, 2011 [Issue 6235] Regression(DMD 2.053) ICE on typeof(Range.init[0..$]) inside a templated struct/class | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rob Jacques | http://d.puremagic.com/issues/show_bug.cgi?id=6235 --- Comment #4 from yebblies <yebblies@gmail.com> 2011-07-04 18:05:23 EST --- (In reply to comment #3) > > exp[... $ ... ] => exp[... exp.length ...] ? > > I think it's because exp may have side effects, so it should only be evaluated once. Ah, of course. Can you see anything wrong with rewriting it as: (auto __tmp = exp, __tmp[... __tmp.length ...]) I'll have to dig into it to be sure, but I think something like this would solve a lot of the problems caused by __dollar. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 04, 2011 [Issue 6235] Regression(DMD 2.053) ICE on typeof(Range.init[0..$]) inside a templated struct/class | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rob Jacques | http://d.puremagic.com/issues/show_bug.cgi?id=6235 --- Comment #5 from Don <clugdbug@yahoo.com.au> 2011-07-04 06:00:57 PDT --- (In reply to comment #4) > (In reply to comment #3) > > > exp[... $ ... ] => exp[... exp.length ...] ? > > > > I think it's because exp may have side effects, so it should only be evaluated once. > > Ah, of course. > Can you see anything wrong with rewriting it as: > (auto __tmp = exp, __tmp[... __tmp.length ...]) Not sure. There might be problem if exp defines postblit. > I'll have to dig into it to be sure, but I think something like this would solve a lot of the problems caused by __dollar. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 24, 2011 [Issue 6235] Regression(2.053) ICE on typeof(Range.init[0..$]) inside a templated struct/class | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rob Jacques | http://d.puremagic.com/issues/show_bug.cgi?id=6235 --- Comment #6 from Don <clugdbug@yahoo.com.au> 2011-10-24 00:35:48 PDT --- Regression introduced by me: https://github.com/D-Programming-Language/dmd/commit/03e022f8cbfed660d31ebe6217f3faab01ca7472 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 04, 2011 [Issue 6235] Regression(2.053) ICE on typeof(Range.init[0..$]) inside a templated struct/class | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rob Jacques | http://d.puremagic.com/issues/show_bug.cgi?id=6235 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #7 from Don <clugdbug@yahoo.com.au> 2011-11-03 23:56:14 PDT --- https://github.com/D-Programming-Language/dmd/commit/56d4a1bc4781837823665ef7423aa7e2b2df1083 -- 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