Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
January 08, 2011 [Issue 5427] New: constructors .di files lack modifiers | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=5427 Summary: constructors .di files lack modifiers Product: D Version: unspecified Platform: Other OS/Version: All Status: NEW Severity: major Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: jmdavisProg@gmx.com --- Comment #0 from Jonathan M Davis <jmdavisProg@gmx.com> 2011-01-08 01:16:02 PST --- Take this program for example (you need druntime from svn for this to compile): import core.time; int func() pure { auto d = dur!"msecs"(12); return 0; } void main() { } It fails to compile, giving this lovely message: /home/jmdavis/Downloaded_Files/dmd/dmd2/linux/bin/../../src/druntime/import/core/time.di(193): Error: pure function 'dur' cannot call impure function 'this' /home/jmdavis/Downloaded_Files/dmd/dmd2/linux/bin/../../src/druntime/import/core/time.di(193): Error: (Duration __ctmp1 = 0; , __ctmp1).this is not nothrow /home/jmdavis/Downloaded_Files/dmd/dmd2/linux/bin/../../src/druntime/import/core/time.di(191): Error: function core.time.dur!("msecs").dur 'dur' is nothrow yet may throw l.d(5): Error: template instance core.time.dur!("msecs") error instantiating In core.time.d, Duration's constructor looks like this: @safe this(long hnsecs) pure nothrow { _hnsecs = hnsecs; } In core.time.di, it looks like this: @safe this(long hnsecs) { _hnsecs = hnsecs; } Notice that both pure and nothrow are missing (though apparently @safe survived). This makes Duration unusable in pure functions, even though its constructor is actually pure. This is a big problem for std.datetime, which uses both nothrow and pure heavily. I'll have to discuss with Sean the best way to fix this for core.time in the short term, but I'm marking this bug as major rather than normal because it affects druntime. Though truth be told, I don't know why druntime even uses .di files. Regardless, this bug is a definite problem. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 08, 2011 [Issue 5427] constructors .di files lack modifiers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=5427 Jonathan M Davis <jmdavisProg@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|major |normal --- Comment #1 from Jonathan M Davis <jmdavisProg@gmx.com> 2011-01-08 01:19:00 PST --- Interestingly enough, it looks like the problem goes away if you place nothrow and pure _before_ this() rather than after. So, there _does_ appear to be a trivial workaround, but still, it needs to be fixed. As there is a trivial workaround, however, I'll downgrade its severity to normal. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 12, 2013 [Issue 5427] constructors in .di files lack modifiers if they are after the function name in the .d file | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=5427 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |andrej.mitrovich@gmail.com Resolution| |WORKSFORME --- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-11 19:57:20 PST --- In both samples the qualifiers are now outputted properly. -- 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