Bug 4280 – std.typecons.Tuple problem with one field
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-06-06T04:59:00Z
Last change time
2015-06-09T05:13:46Z
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2010-06-06T04:59:29Z
This D2 program looks correct:
import std.typecons: Tuple;
void main() {
auto t = Tuple!(int)(1);
}
But DMD v2.046 prints at compile-time:
...\src\phobos\std\typecons.d(349): Error: no property 'Types' for type 'int'
Error: no property 'length' for type 'int'
...\src\phobos\std\typecons.d(349): Error: static assert (0u == 1u) is false
test.d(3): instantiated from here: __ctor!(int)
If tuples don't support a single item, then the docs have to say it, and it's better to produce a better error message.
Comment #1 by andrej.mitrovich — 2010-08-29T20:43:30Z
This works fine in 2.048.
Comment #2 by bearophile_hugs — 2010-08-29T23:31:16Z