December 15, 2013 [Issue 11747] New: Better error message with @disabled toString | ||||
---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=11747 Summary: Better error message with @disabled toString Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@eml.cc 2013-12-15 03:04:33 PST --- A low priority enhancement suggestion. A way to disallow the printing of a struct is to use @disable on its toString: struct Foo { @disable string toString(); } void main() { import std.stdio; Foo f; writeln(f); } But the missing function is only detected at link time (dmd 2.065alpha): test2.obj(test2) Error 42: Symbol Undefined _D5test23Foo8toStringMFZAya So perhaps it's better to add to write a template constraint that verifies toString is not @disabled, to catch the problem at compile-time. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation