Closed georgjz closed 2 years ago
I'd propose to use a if constexpr
for both functions in question:
int ProjectConverter3To4::convert() {
if constexpr (!MODULE_REGEX_ENABLED) {
ERR_FAIL_V_MSG(ERROR_CODE, "Can't run converter for Godot 3.x projects as RegEx module is disabled.");
}
else {
// rest of code
}
}
Or trivially, move the definition of ERROR_CODE
before #ifdef MODULE_REGEX_ENABLED
. I'd be happy to commit a PR solving this.
The whole class relies on RegEx, so your if constexpr
solution would require adding a lot of guards in other functions.
Moving the definition of ERROR_CODE
is the simplest and thus best solution.
Godot version
01efb938424c7678f5a834e25244d4ed741c563a
System information
Windows 10, MSVC 14.3
Issue description
The constant
const int ERROR_CODE = 77;
at line 42 of the fileeditor\project_converter_3_to_4.cpp
is only defined in one branch of the overall conditional-compilation expression:The functions
ProjectConverter3To4::convert()
andProjectConverter3To4::validation_conversion()
cannot be compiled asERROR_CODE
is not in scope for them.This results in the follwing error message:
Steps to reproduce
Clone repository and build on indicated commit with the following custom script:
Minimal reproduction project
No response