[Issue 4274] New: Better array of inner structs error message

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 4 18:20:51 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4274

           Summary: Better array of inner structs error message
           Product: D
           Version: future
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-06-04 18:20:50 PDT ---
This wrong D2 program:

void main() {
    struct Foo {
        void bar() {}
    }
    auto foos = new Foo[1]; // line 5
}


At compile time dmd v2.046 prints:
temp.d(5): Error: cannot have array of inner structs Foo

But for D newbies coming from C or C++ can find that error message cryptic.
Using a static struct solves this problem. So a possible error message can be:

temp.d(5): Error: cannot have array of inner structs Foo, you can use a 'static
struct' instead.

This improved error message is not perfect, but it seems better.

(I don't understand why D error messages don't have the ending full stop.)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list