Avoid using std::get except in holds_alternative-asserting accessors

This commit is contained in:
Rangi42
2024-03-03 23:33:23 -05:00
parent 13904dc536
commit f2c875e71e
6 changed files with 23 additions and 8 deletions

View File

@@ -228,14 +228,14 @@ static int32_t computeRPNExpr(Patch const &patch, std::vector<Symbol> const &fil
fileSymbols[value].name.c_str());
isError = true;
value = 1;
} else if (!std::holds_alternative<Label>(symbol->data)) {
} else if (Label const *label = std::get_if<Label>(&symbol->data); label) {
value = label->section->bank;
} else {
error(patch.src, patch.lineNo,
"Requested BANK() of non-label symbol \"%s\"",
fileSymbols[value].name.c_str());
isError = true;
value = 1;
} else {
value = std::get<Label>(symbol->data).section->bank;
}
break;