Bug 19529 – An example from Wikipedia does not compile

Status
RESOLVED
Resolution
WONTFIX
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-12-31T04:18:15Z
Last change time
2018-12-31T14:31:45Z
Assigned to
No Owner
Creator
Victor Porton

Comments

Comment #0 by porton — 2018-12-31T04:18:15Z
--- template t(T){ T get(){ return mValue; } } class C{ private int mValue; mixin t(int); } --- $ dmd test.d test.d(9): Error: ; expected after mixin test.d(9): Error: no identifier for declarator int test.d(9): Error: declaration expected, not ) The code above is from https://en.wikibooks.org/wiki/D_Programming/Mixins
Comment #1 by porton — 2018-12-31T04:19:17Z
Sorry, WikiBooks not Wikipedia.
Comment #2 by porton — 2018-12-31T04:20:34Z
$ dmd --version DMD64 D Compiler v2.080.1
Comment #3 by porton — 2018-12-31T04:35:51Z
It doesn't work with DMD64 D Compiler v2.083.1, too.
Comment #4 by alphaglosined — 2018-12-31T04:52:34Z
It's not being maintained by anyone by the looks. Truth be told I was unaware that it even existed. Use e.g. https://tour.dlang.org/ or http://ddili.org/ders/d.en/index.html which are actively being maintained and correct. The page you want is http://ddili.org/ders/d.en/mixin.html
Comment #5 by destructionator — 2018-12-31T14:31:45Z
The author there just forgot the ! for template arguments. being a wiki, i just hit edit and added them. https://en.wikibooks.org/w/index.php?title=D_Programming/Mixins&stable=0