D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6275 - Const values in tuples
Summary: Const values in tuples
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 major
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks:
 
Reported: 2011-07-08 18:09 UTC by bearophile_hugs
Modified: 2011-09-16 14:04 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2011-07-08 18:09:16 UTC
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 2 bearophile_hugs 2011-09-16 14:04:54 UTC
Thank you.