[Issue 11761] New: is(typeof(r.methodReturningThis) == typeof(r)) fails
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Dec 17 21:49:30 PST 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11761
Summary: is(typeof(r.methodReturningThis) == typeof(r)) fails
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: thecybershadow at gmail.com
--- Comment #0 from Vladimir Panteleev <thecybershadow at gmail.com> 2013-12-18 07:49:23 EET ---
Currently, associative arrays' byKey and byValue methods do not return forward
ranges (although this was the intention). The isForwardRange check fails.
The cause can be reduced to the following code:
struct R
{
R save() { return this; }
}
void main()
{
R r1 = void;
static assert (is(typeof(r1.save) == typeof(r1)));
}
The compiler complains:
test.d(9): Error: static assert (is(R() == R)) is false
Note the parens in "R() == R".
The problem goes away, if either r1.save is replaced with r1.save(), or the
save method declaration is annotated with @property (despite the -property
switch not being used).
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list