[Issue 5073] wrong file name in error message for "voids have no value" inside alias templates (affects std.algorithm.map)
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jan 20 09:35:16 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5073
--- Comment #3 from Rob Jacques <sandford at jhu.edu> 2011-01-20 09:33:15 PST ---
(In reply to comment #2)
> (In reply to comment #1)
> > In DMD 2.051, this error message has ceased to be generated for certain inputs
> > and instead a runtime access violation is generated. Here is a reduced test
> > case:
> >
> > struct Bar(T) {
> > T x;
> > Bar dot(Bar b) { return Bar(x+b.x); }
> > }
> >
> > void main(string[] args) {
> > Bar!real b;
> > Bar!real[] data = new Bar!real[5];
> > auto foobar = map!((a){return a.dot(b); })(data);
> > return;
> > }
>
> I just tried the example above with 2.051. It compiles and runs. Could you
> please provide a different example? Thanks!
While it does compile on my system, when it runs it causes an "object.Error:
Access Violation". I'm on an Intel Core-i7 920 (Quad core) running Windows 7
64-bit. Just to double check, here is a more extensive version of the same test
which verifies the map is run correctly.
void main(string[] args) {
Bar!real b = Bar!real(5);
Bar!real[] data = new Bar!real[5];
foreach(i,ref d;data)
d.x = i;
Bar!real[] expected = new Bar!real[5];
foreach(i,ref e;expected)
e = data[i].dot(b);
auto foobar = map!((a){return a.dot(b); })(data);
foreach(z;zip(foobar,expected))
assert(z[0].x == z[1].x);
return;
}
Also, does the example from my first post compile & run for you?
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list