Bug 9901 – string return from inner template function error

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-04-07T15:31:00Z
Last change time
2015-06-17T21:03:42Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2013-04-07T15:31:41Z
template isGood(T) { enum isGood = true; } void main() { string foo(R)(R data) if (isGood!R) { return ""; } foo(1); } DMD 2.063alpha: temp.d(5): Error: found 'foo' when expecting ';' following statement temp.d(5): Error: found 'data' when expecting ')' temp.d(5): Error: C style cast illegal, use cast(R)R temp.d(5): Error: found ')' when expecting ';' following statement While this very similar program compiles with no errors: template isGood(T) { enum isGood = true; } void main() { immutable(char)[] foo(R)(R data) if (isGood!R) { return ""; } foo(1); }
Comment #1 by k.hara.pg — 2013-04-07T20:21:02Z
Comment #2 by github-bugzilla — 2013-04-11T10:44:15Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/ac4f2f4e42dc8404ae6a177944ea5183d2ba4a9c fix Issue 9901 - string return from inner template function error https://github.com/D-Programming-Language/dmd/commit/9432dd51cedc93cad54214974f810155e7648bea Merge pull request #1865 from 9rnsr/fix9901 Issue 9901 - string return from inner template function error
Comment #3 by github-bugzilla — 2015-03-29T07:39:14Z
Comment #4 by github-bugzilla — 2015-06-17T21:03:42Z