final switch problem

H. S. Teoh hsteoh at quickfur.ath.cx
Sat Jun 13 14:41:26 UTC 2020


On Sat, Jun 13, 2020 at 09:02:21AM +0000, John Chapman via Digitalmars-d-learn wrote:
[...]
> module test;
> 
> import std.uni;
> 
> enum Cheese { cheddar, edam }
> 
> void test(Cheese cheese) {
>   final switch (cheese) {
>   case Cheese.cheddar: break;
>   case Cheese.edam: break;
>   }
> }
> 
> void main() {
>   test(Cheese.cheddar);
> }
> ---
> 
> error LNK2019: unresolved external symbol "pure nothrow @nogc @safe void
> core.internal.switch_.__switch_error!().__switch_error(immutable(char)[],
> ulong)" (_D4core8internal7switch___T14__switch_errorZQrFNaNbNiNfAyamZv)
> referenced in function _Dmain
[...]

Tested it on git master, DMD 2.091.1-beta.1 (Linux/64), could not
reproduce problem.

>From the error message, my first guess would be that your compiler and
druntime are out-of-sync somehow.


T

-- 
My father told me I wasn't at all afraid of hard work. I could lie down right next to it and go to sleep. -- Walter Bright


More information about the Digitalmars-d-learn mailing list