Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
May 29, 2013 [Issue 10197] New: [REG2.063] Cannot cast overloaded template property result | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=10197 Summary: [REG2.063] Cannot cast overloaded template property result Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: rejects-valid Severity: regression Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: k.hara.pg@gmail.com --- Comment #0 from Kenji Hara <k.hara.pg@gmail.com> 2013-05-28 23:31:25 PDT --- From: http://forum.dlang.org/post/pjgyejdfumdpupgjjajv@forum.dlang.org This code should work, but doesn't. template OriginalType(T) { static if (is(T U == enum)) alias OriginalType = U; else static assert(0); } enum E : int { F = -20 } struct S { int val; @trusted @property T as(T)() if (is(T == int) && !is(T == enum)) { return cast(T)(val); } @trusted @property T as(T)() if (is(T == enum)) { return cast(T)as!(OriginalType!T); // L21 } } void main() { S val = S(-20); assert(val.as!int == -20); assert(val.as!E == E.F); // L28 } output: test.d(21): Error: cannot cast this.as!(OriginalType!(T)) test.d(28): Error: template instance test.S.as!(E) error instantiating -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 29, 2013 [Issue 10197] [REG2.063] Cannot cast overloaded template property result | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=10197 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2013-05-28 23:37:34 PDT --- https://github.com/D-Programming-Language/dmd/pull/2093 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 29, 2013 [Issue 10197] [REG2.063] Cannot cast overloaded template property result | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=10197 --- Comment #2 from github-bugzilla@puremagic.com 2013-05-29 12:54:22 PDT --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/0a80b5214ba0e0549c417971fd9842c97bef8abe fix Issue 10197 - Cannot cast overloaded template property result https://github.com/D-Programming-Language/dmd/commit/1f9e6739472c4c15b379563698e720fea7badd4e Merge pull request #2093 from 9rnsr/fix10197 Issue 10197 - [REG2.063] Cannot cast overloaded template property result -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 29, 2013 [Issue 10197] [REG2.063] Cannot cast overloaded template property result | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=10197 Andrei Alexandrescu <andrei@erdani.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |andrei@erdani.com Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 29, 2013 [Issue 10197] [REG2.063] Cannot cast overloaded template property result | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=10197 --- Comment #3 from github-bugzilla@puremagic.com 2013-05-29 15:04:30 PDT --- Commits pushed to 2.063 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/0b0760a106aaa3fd49da5e4b889115cc70b8d3e8 Merge pull request #2093 from 9rnsr/fix10197 Issue 10197 - [REG2.063] Cannot cast overloaded template property result https://github.com/D-Programming-Language/dmd/commit/8f3b041b390f62a6552fb7324233bdeebe573ba3 Merge pull request #2093 from 9rnsr/fix10197 Issue 10197 - [REG2.063] Cannot cast overloaded template property result -- 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