Thread overview
[Issue 4540] New: Better error message for wrong switch type
Dec 28, 2012
Andrej Mitrovic
Jan 11, 2013
Kenji Hara
July 31, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4540

           Summary: Better error message for wrong switch type
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2010-07-31 04:29:59 PDT ---
This is a wrong D2 program:

void main() {
    float x;
    switch (x) {
        default:
    }
}


dmd 2.047 prints:
test.d(3): Error: 'x' is not of integral type, it is a float


But in D strings too are allowed in switch, so a better error message can be: test.d(3): Error: 'x' is not of integral type or string, it is a float

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 28, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4540


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
                 CC|                            |andrej.mitrovich@gmail.com
         AssignedTo|nobody@puremagic.com        |andrej.mitrovich@gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-12-27 18:23:30 PST ---
https://github.com/D-Programming-Language/dmd/pull/1417

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=4540



--- Comment #2 from github-bugzilla@puremagic.com 2013-01-10 23:54:43 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/8ab6ab22b7e7d160732d72c71e9953e750f6b1be Fixes Issue 4540 - Better diagnostic for wrong switch type.

https://github.com/D-Programming-Language/dmd/commit/98e20bc85dbfd63e11a607c813fc6ae73554b631 Merge pull request #1417 from AndrejMitrovic/Fix4540

Issue 4540 - Better diagnostic for wrong switch type.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=4540


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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