diff options
Diffstat (limited to 'source/slang/slang-ir-lower-reinterpret.cpp')
| -rw-r--r-- | source/slang/slang-ir-lower-reinterpret.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/slang/slang-ir-lower-reinterpret.cpp b/source/slang/slang-ir-lower-reinterpret.cpp index afc710539..34d4b77d9 100644 --- a/source/slang/slang-ir-lower-reinterpret.cpp +++ b/source/slang/slang-ir-lower-reinterpret.cpp @@ -60,15 +60,23 @@ struct ReinterpretLoweringContext auto fromType = operand->getDataType(); auto toType = inst->getDataType(); SlangInt fromTypeSize = getAnyValueSize(fromType); + bool cantPack = false; if (fromTypeSize < 0) { + cantPack = true; sink->diagnose(inst->sourceLoc, Slang::Diagnostics::typeCannotBePackedIntoAnyValue, fromType); } SlangInt toTypeSize = getAnyValueSize(toType); if (toTypeSize < 0) { + cantPack = true; sink->diagnose(inst->sourceLoc, Slang::Diagnostics::typeCannotBePackedIntoAnyValue, toType); } + if (fromTypeSize != toTypeSize + && cantPack == false) + { + sink->diagnose(inst->sourceLoc, Slang::Diagnostics::notEqualReinterpretCastSize, fromType, fromTypeSize, toType, toTypeSize); + } SlangInt anyValueSize = Math::Max(fromTypeSize, toTypeSize); IRBuilder builder(module); |
