final switch problem
John Chapman
johnch_atms at hotmail.com
Sat Jun 13 09:02:21 UTC 2020
If I use a final switch and import std.uni (or any other module
that imports it, such as std.string), I'm getting unresolved
external symbol errors with DMD 2.092.
This code triggers the issue:
---
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
If I remove "final" and add a default case, it compiles fine. Is
this a bug or have I made a mistake? This worked a few days ago
and I haven't changed my setup since then.
More information about the Digitalmars-d-learn
mailing list