[Issue 4176] Link error in switch with 4 or more cases and no default

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 25 03:04:16 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=4176

Walter Bright <bugzilla at digitalmars.com> changed:

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

--- Comment #3 from Walter Bright <bugzilla at digitalmars.com> ---
What's happening is __d_switch_error is in phobos.lib. Phobos.lib is not
automatically linked in unless there's a "main" definition in the file. Hence
__d_switch_error is undefined.

__d_switch_error is what is called when there isn't a default.

In any case, now this error message is emitted:

test.d(2): Error: switch statement without a default; use final switch or add
default: assert(0); or add default: break;

--


More information about the Digitalmars-d-bugs mailing list