Bug 14900 – 2.068.0 change log example does not compile

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-08-10T14:25:00Z
Last change time
2015-08-24T11:44:30Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
timon.gehr

Comments

Comment #0 by timon.gehr — 2015-08-10T14:25:53Z
Consider the code example at http://dlang.org/changelog.html#index-type-followed-ident : --- alias TypeTuple(T...) = T; struct S { alias T = int; alias U = TypeTuple!(long, string); } alias Types = Tuple!(S, S); Types[0].T a; // Types[0] == S, then typeof(a) == S.T == int Types[0].U[1] b; // Types[0].U == S.U, then typeof(b) == S.U[1] == string --- After fixing the typo: --- alias TypeTuple(T...)=T; struct S{ alias T=int; alias U=TypeTuple!(long,string); } alias Types=TypeTuple!(S,S); Types[0].T a; // Types[0] == S, then typeof(a) == S.T == int Types[0].U[1] b; // Types[0].U == S.U, then typeof(b) == S.U[1] == string --- We get (DMD 2.068.0): tt.d(10): Error: expected TypeTuple when indexing ('[0]'), got 'Types'. tt.d(11): Error: expected TypeTuple when indexing ('[0]'), got 'Types'. tt.d(11): Error: expected TypeTuple when indexing ('[0]'), got 'Types'. This should compile and do what is indicated.
Comment #1 by k.hara.pg — 2015-08-10T16:03:51Z
OH MY GOD! The example code does not work even on master! When I wrote the example code, I did tested it something like. alias TypeTuple(T...) = T; struct S { alias T = int; alias U = TypeTuple!(long, string); } alias Types = TypeTuple!(S, S); struct X(Types...) // used tuple parameter { Types[0].T a; // Types[0] == S, then typeof(a) == S.T == int Types[0].U[1] b; // Types[0].U == S.U, then typeof(b) == S.U[1] == string } alias x = X!Types; After that, I rewrote the example code to current style WITHOUT testing! Finally, unworkable example code is shown in changelog...
Comment #2 by code — 2015-08-10T16:41:00Z
(In reply to Kenji Hara from comment #1) > After that, I rewrote the example code to current style WITHOUT testing! > Finally, unworkable example code is shown in changelog... No worries, let's update the changelog then, and apparantly you're already working on a fix. https://github.com/D-Programming-Language/dlang.org/pull/1063 https://github.com/D-Programming-Language/dmd/pull/4876
Comment #3 by github-bugzilla — 2015-08-10T16:47:31Z
Comment #4 by github-bugzilla — 2015-08-10T16:48:53Z
Comment #5 by k.hara.pg — 2015-08-10T16:51:08Z
(In reply to Martin Nowak from comment #2) > No worries, let's update the changelog then, and apparantly you're already > working on a fix. > > https://github.com/D-Programming-Language/dlang.org/pull/1063 Thank you... I confirmed and merged the fix for the changelog example.
Comment #6 by k.hara.pg — 2015-08-11T07:55:51Z
Comment #7 by github-bugzilla — 2015-08-23T10:10:18Z
Commits pushed to stable at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/e68741604f64b3e0173fd9ffd2125d6c1e4e65ae fix Issue 14900 - 2.068.0 change log example does not compile Fix incomplete parser for statement scope declarations. https://github.com/D-Programming-Language/dmd/commit/4cf5cf76e2399f14d5673439da48cf511546a7b3 Merge pull request #4918 from 9rnsr/fix14889 Issue 14889 & 14900 & [REG2.068.0] 14911 - Reimplement fix for issue 1215
Comment #8 by github-bugzilla — 2015-08-24T11:44:30Z