forked from OSchip/llvm-project
[flang] add a static assert in CheckUnitNumberInRangeImpl
Add a check that CheckUnitNumberInRangeImpl is not needlessly instantiated. Differential Revision: https://reviews.llvm.org/D123285
This commit is contained in:
parent
e995526e66
commit
9cfa899b87
|
@ -1280,6 +1280,9 @@ template <typename INT>
|
|||
static enum Iostat CheckUnitNumberInRangeImpl(INT unit, bool handleError,
|
||||
char *ioMsg, std::size_t ioMsgLength, const char *sourceFile,
|
||||
int sourceLine) {
|
||||
static_assert(sizeof(INT) >= sizeof(ExternalUnit),
|
||||
"only intended to be used when the INT to ExternalUnit conversion is "
|
||||
"narrowing");
|
||||
if (unit != static_cast<ExternalUnit>(unit)) {
|
||||
Terminator oom{sourceFile, sourceLine};
|
||||
IoErrorHandler errorHandler{oom};
|
||||
|
|
Loading…
Reference in New Issue