Bug 6275 – Const values in tuples

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2011-07-08T18:09:00Z
Last change time
2011-09-16T14:04:54Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2011-07-08T18:09:16Z
I think the need to put const values inside tuples is very common: import std.typecons; void main() { const int x = 1; auto t1 = tuple(x); alias Tuple!(const(int)) T; auto t2 = T(1); } In DMD 2.054beta this gives: ...\dmd\src\phobos\std\typecons.d(666): Error: can only initialize const member _field_field_0 inside constructor test.d(4): Error: template instance std.typecons.tuple!(const(int)) error instantiating
Comment #1 by k.hara.pg — 2011-09-16T13:19:06Z
Comment #2 by bearophile_hugs — 2011-09-16T14:04:54Z
Thank you.