D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6688 - An struct that has @disable constructor does not work with template constraint
Summary: An struct that has @disable constructor does not work with template constraint
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-17 21:13 UTC by Masahiro Nakagawa
Modified: 2011-10-09 15:22 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 Masahiro Nakagawa 2011-09-17 21:13:34 UTC
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 Kenji Hara 2011-09-18 16:11:34 UTC
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.