Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
May 24, 2012 [Issue 8138] New: Attribute inference fails with Voldemort type | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=8138 Summary: Attribute inference fails with Voldemort type Product: D Version: unspecified Platform: All 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> 2012-05-23 21:47:20 PDT --- This stripped down code from one of my programs import std.algorithm; import std.range; import std.traits; void main() { ubyte[] buffer = [1, 2, 9, 7, 6]; auto filtered = filter!"true"(buffer); auto br2 = bitReader(filtered); } final class BitReader(R) if(isInputRange!R && is(ElementType!R : const ubyte)) { this(R)(R bytes) { _bytes = bytes; } @property bool empty() const { return _bytes.empty; } R _bytes; } BitReader!R bitReader(R)(R r) if(isInputRange!R && is(ElementType!R : const ubyte)) { return new BitReader!R(r); } results in this compilation error: q.d(24): Error: function std.algorithm.filter!("true").filter!(ubyte[]).filter.Result.empty () is not callable using argument types ( If empty is changed to mutable, the code compiles just fine, but if it's either const or inout, it fails. Given that the empty that filter's Result's empty is calling is std.array.empty (whose parameter is in), filter's Result's empty should be inferred as const, but it appears that it's not, since my class' empty can't be const due to the call to filter's Result's empty. My _guess_ would be that the problem stems from the fact that Result isn't templated (rather filter is templated, and Result is generated as part of that template), but I don't know. Regarldess, this is a major problem for constness and Voldemort types. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 04, 2012 [Issue 8138] Attribute inference fails with Voldemort type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=8138 Jonathan M Davis <jmdavisProg@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|major |blocker --- Comment #1 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-06-04 02:24:39 PDT --- Note that this blocks const-ifying or inout-ifying some stuff in std.range and std.algorithm, making it harder to make them const-correct. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 10, 2013 [Issue 8138] Attribute inference fails with Voldemort type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=8138 Lars T. Kyllingstad <bugzilla@kyllingen.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@kyllingen.net --- Comment #2 from Lars T. Kyllingstad <bugzilla@kyllingen.net> 2013-06-10 13:42:20 PDT --- @safe, pure and nothrow aren't inferred in Voldemort types either. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 10, 2013 [Issue 8138] Attribute inference fails with Voldemort type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=8138 --- Comment #3 from Jonathan M Davis <jmdavisProg@gmx.com> 2013-06-10 14:48:34 PDT --- @safe, pure and nothrow are supposed to be inferred on all templates, so if they're not inferred for Voldemort types, and they're templated (as they usually are), then it's definitely a bug (and I think that there's at least one open bug on that, but I'm not sure). But reading over this bug report, I'm not quite sure what I was thinking when I wrote it. const is _never_ inferred. Issue# 8407 is an enhancement for that which might solve this problem, but from what I can tell, there is no bug in dmd here. Either filter needs to be improved via static ifs, or we need something like issue# 8407 to be implemented in order to fix the problem that's occuring here, but I don't think that there's an actual compiler bug, and I don't know why I thought that there was at the time that I reported it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 10, 2013 [Issue 8138] Attribute inference fails with Voldemort type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=8138 Jonathan M Davis <jmdavisProg@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 11, 2013 [Issue 8138] Attribute inference fails with Voldemort type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=8138 --- Comment #4 from Lars T. Kyllingstad <bugzilla@kyllingen.net> 2013-06-10 23:11:19 PDT --- I've added a new bug report: issue 10329 -- 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