← Back to index
|
Original Bugzilla link
Bug 21244 – Error: expression `hasToString!(..., char)` of type `void` does not have a boolean value
Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-09-14T02:26:22Z
Last change time
2024-12-13T19:11:26Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
Vladimir Panteleev
Moved to GitHub: dmd#19783 →
Comments
Comment #0
by dlang-bugzilla — 2020-09-14T02:26:22Z
Looks like a DMD problem with recursive templated types. Partial reduction: //////////////////////// test.d //////////////////////// import std.format; import std.stdio; struct M(_) { struct N { M* next; void print() { next.print(); } void toString(void delegate(const(char)[]) sink) { if (next) sink.formattedWrite("%s", *next); } } N* root; void print() { writeln(this); } void toString(void delegate(const(char)[]) sink) { if (root) sink.formattedWrite("%s", *root); } } M!int x; //////////////////////////////////////////////////////// Yields a wall of errors starting with: .../std/format.d(4420): Error: expression hasToString!(M!int, char) of type void does not have a boolean value
Comment #1
by robert.schadek — 2024-12-13T19:11:26Z
THIS ISSUE HAS BEEN MOVED TO GITHUB
https://github.com/dlang/dmd/issues/19783
DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB