Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
October 31, 2013 [Issue 11401] New: ElementType returns constructor instead of type | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=11401 Summary: ElementType returns constructor instead of type Product: D Version: D2 Platform: x86_64 OS/Version: Linux Status: NEW Severity: regression Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: jcrapuchettes@gmail.com --- Comment #0 from Jonathan Crapuchettes <jcrapuchettes@gmail.com> 2013-10-31 09:42:06 PDT --- Using latest git HEAD, the following code produces an error where 2.063.2 does not. It appears to be a problem with either std.range.ElementType or std.traits.lvalueOf. Code --- import std.range; void main() { alias ElementType!RowRange E; static assert(is(typeof(E.id)), E.stringof~" is expected to have a 'id' member"); } struct RowRange { BasicNode front() { return BasicNode.init; } } struct BasicNode { ushort id; } Output --- $ ~/dmd-git/build/bin/dmd serialize.d test.d(6): Error: static assert "BasicNode() is expected to have a 'id' member" -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 03, 2013 [Issue 11401] ElementType returns constructor instead of type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan Crapuchettes | http://d.puremagic.com/issues/show_bug.cgi?id=11401 Andrei Alexandrescu <andrei@erdani.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrei@erdani.com --- Comment #1 from Andrei Alexandrescu <andrei@erdani.com> 2013-11-03 13:44:30 PST --- Turns out it's a compiler bug, not a library one. I reduced the code to: struct RowRange { BasicNode front() { return BasicNode.init; } } struct BasicNode { ushort id; } void main() { alias E1 = typeof(RowRange.init.front()); static assert(is(typeof(E1.id)), E1.stringof~" is expected to have a 'id' member"); alias E2 = typeof(RowRange.init.front); static assert(is(typeof(E2.id)), E2.stringof~" is expected to have a 'id' member"); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 04, 2013 [Issue 11401] ElementType returns constructor instead of type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan Crapuchettes | http://d.puremagic.com/issues/show_bug.cgi?id=11401 --- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2013-11-03 18:33:49 PST --- This is git-head only issue. Introduced by: https://github.com/D-Programming-Language/phobos/pull/1658 (In reply to comment #1) > alias E1 = typeof(RowRange.init.front()); > static assert(is(typeof(E1.id)), > E1.stringof~" is expected to have a 'id' member"); > alias E2 = typeof(RowRange.init.front); > static assert(is(typeof(E2.id)), > E2.stringof~" is expected to have a 'id' member"); Currently typeof(non_property_func) returns the function type, not its return type. It is intended behavior, and this is not a compiler issue. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 04, 2013 [Issue 11401] ElementType returns constructor instead of type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan Crapuchettes | http://d.puremagic.com/issues/show_bug.cgi?id=11401 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull, rejects-valid --- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2013-11-03 19:15:28 PST --- https://github.com/D-Programming-Language/phobos/pull/1681 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 04, 2013 [Issue 11401] ElementType returns constructor instead of type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan Crapuchettes | http://d.puremagic.com/issues/show_bug.cgi?id=11401 --- Comment #4 from github-bugzilla@puremagic.com 2013-11-04 03:37:13 PST --- Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/a9eb6219b4d03ace4e6688eaeb3dfcd4f90a9faf fix Issue 11401 - ElementType returns constructor instead of type 1. For `exp.member`, compiler always try to resolve property/optional parenthesis on `exp`. so use `front.init`. 2. Built-in `init` property always returns rvalue, so `front.init` won't invoke postblit. https://github.com/D-Programming-Language/phobos/commit/d743e6caa9c52e53f6bac38fb925d46b65071f78 Merge pull request #1681 from 9rnsr/fix11401 [REG2.065a] Issue 11401 - ElementType returns constructor instead of type -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 04, 2013 [Issue 11401] ElementType returns constructor instead of type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan Crapuchettes | http://d.puremagic.com/issues/show_bug.cgi?id=11401 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED -- 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