Bug 6688 – An struct that has @disable constructor does not work with template constraint
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2011-09-17T21:13:00Z
Last change time
2011-10-09T15:22:40Z
Assigned to
nobody
Creator
repeatedly
Comments
Comment #0 by repeatedly — 2011-09-17T21:13:34Z
Following code causes compilation error in dmd 2.055.
code:
-----
struct S
{
@disable this();
this(int a) {}
}
S s = S(10);
writeln(s);
-----
output:
-----
/path/to/phobos/std/stdio.d(1483): Error: variable std.stdio.writeln(T...) if (T.length == 0).writeln._args_field_0 initializer required for type S
/path/to/phobos/std/stdio.d(1495): Error: variable std.stdio.writeln(T...) if (T.length == 1 && is(typeof(args[0]) : const(char)[])).writeln._args_field_0 initializer required for type S
/path/to/phobos/std/stdio.d(1508): Error: variable std.stdio.writeln(T...) if (T.length > 1 || T.length == 1 && !is(typeof(args[0]) : const(char)[])).writeln._args_field_0 initializer required for type S
-----
I think this is a regression.
Comment #1 by k.hara.pg — 2011-09-18T16:11:34Z
This issue will be fixed by dmd/pull/286 as a side effect.
https://github.com/D-Programming-Language/dmd/pull/285
That patch applies STCparameter to function parameters correctly inside template constraint, then errors are suppressed.