Please consider the following program:
import std.exception;
void main()
{
struct A {
int a;
@disable this(this);
@disable ref A opAssign(const ref A);
ref A opOpAssign(string op: ~)(int data) {
a += data;
return this;
}
lambda manually:
assertThrown!Exception((ref A aa) { aa ~= 3; }(a));
tl;dr: no, it's not a bug in the compiler. but the error message is
misleading and you are required to understang some internals to make
sense out of it.
signature.asc
Description: PGP signature
`. it can't see `ref` there, as `a` type is `A`,
not
`ref A`.
you can workaround that with creating the necessary lambda
manually:
assertThrown!Exception((ref A aa) { aa ~= 3; }(a));
tl;dr: no, it's not a bug in the compiler. but the error
message is
misleading and you are required to understang
A`.
you can workaround that with creating the necessary lambda
manually:
assertThrown!Exception((ref A aa) { aa ~= 3; }(a));
tl;dr: no, it's not a bug in the compiler. but the error
message is
misleading and you are required to understang some internals to
make
sense out of it.
Another
http://d.puremagic.com/issues/show_bug.cgi?id=6948
Walter Bright bugzi...@digitalmars.com changed:
What|Removed |Added
Keywords||spec
http://d.puremagic.com/issues/show_bug.cgi?id=6948
Summary: Possible bug in compiler or documentation regarding
signature of opCmp()
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
http://d.puremagic.com/issues/show_bug.cgi?id=6948
Alex R�nne Petersen xtzgzo...@gmail.com changed:
What|Removed |Added
CC|