www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11747] New: Better error message with disabled toString


           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;

But the missing function is only detected at link time (dmd 2.065alpha):

 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: -------
Dec 15 2013