aaron.ballman added inline comments.
================ Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:2654 +/// Emit casts from a PrimType to another PrimType +template <class Emitter> ---------------- ================ Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:2659-2664 + if (FromT == PT_Float) { + // Floating to floating. + if (ToT == PT_Float) { + const llvm::fltSemantics *ToSem = &Ctx.getFloatSemantics(ToQT); + return this->emitCastFP(ToSem, getRoundingMode(E), E); + } ---------------- Should we be early returning if we're casting from float->float like we do for int->int? ================ Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:2667 + // Float to integral. + if (isIntegralType(ToT) || ToT == PT_Bool) + return this->emitCastFloatingIntegral(ToT, E); ---------------- It weirds me out that `isIntegralType()` returns false for a boolean type; that is an integral type as well: http://eel.is/c++draft/basic.types#basic.fundamental-11 ================ Comment at: clang/test/AST/Interp/floats.cpp:106 + + constexpr float intPlusDouble() { + int a = 0; ---------------- Is it intentional that this is returning a float but then comparing below as an integer? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D157596/new/ https://reviews.llvm.org/D157596 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits