[Issue 8847] New: voldemort + inout confuses "is"
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Oct 18 02:13:09 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8847
Summary: voldemort + inout confuses "is"
Product: D
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: major
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: monarchdodra at gmail.com
--- Comment #0 from monarchdodra at gmail.com 2012-10-18 02:13:05 PDT ---
I discovered this inside phobos. First reduced test case:
//----
import std.stdio;
import std.range;
import std.conv;
void main()
{
auto a = iota(1, 2);
auto b = a[];
alias typeof(a) A;
alias typeof(b) B;
writeln("Typeof A: ", A.stringof);
writeln("Typeof B: ", B.stringof);
assert(is(A == B), text(A.stringof, " is different from " , B.stringof));
}
//----
Typeof A: Result
Typeof B: Result
core.exception.AssertError at main.d(13): Result is different from Result
//----
Which is very strange. I found the root condition that recreates this: It is
having a voldemort function that is qualified with inout:
//----
import std.stdio;
import std.conv;
auto S()
{
static struct Result
{
inout(Result) get() inout {return this;}
}
return Result();
}
void main()
{
auto a = S();
auto b = a.get();
alias typeof(a) A;
alias typeof(b) B;
writeln("Typeof A: ", A.stringof);
writeln("Typeof B: ", B.stringof);
assert(is(A == B), text(A.stringof, " is different from " , B.stringof));
}
//----
Typeof A: Result
Typeof B: Result
core.exception.AssertError at main.d(21): Result is different from Result
//----
I'm marking this as major, because it is currently showing up in Phobos:
I wrote a fix for emplace, to bypass opAssign (which it should *not* be
calling), and it turns out there is an emplace that fails to build a
zip.opSlice because of this:
Pull: https://github.com/D-Programming-Language/phobos/pull/837
D2: http://d.puremagic.com/test-results/pull-history.ghtml?repoid=3&pullid=837
--
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