Skip to content

Commit 963c65a

Browse files
committed
Add a long double -> int128 test
1 parent a1372cb commit 963c65a

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

clang/lib/AST/ByteCode/Opcodes.td

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,8 +837,12 @@ def CheckNewTypeMismatchArray : Opcode {
837837

838838
def IsConstantContext: Opcode;
839839

840+
def BitCastTypeClass : TypeClass {
841+
let Types = [Uint8, Sint8, Uint16, Sint16, Uint32, Sint32, Uint64, Sint64, IntAP, IntAPS, Bool, Float];
842+
}
843+
840844
def BitCast : Opcode {
841-
let Types = [FixedSizeIntegralTypeClass];
845+
let Types = [BitCastTypeClass];
842846
let Args = [ArgBool, ArgUint32, ArgFltSemantics];
843847
let HasGroup = 1;
844848
}

clang/test/AST/ByteCode/builtin-bit-cast.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ namespace bitint {
122122
// ref-note {{initializer of 'IB' is not a constant expression}}
123123
}
124124

125+
/// FIXME: This is correct in the current interpreter.
126+
namespace LongDouble {
127+
constexpr long double F = 12.0;
128+
constexpr __int128 I = __builtin_bit_cast(__int128, F); // ref-error {{must be initialized by a constant expression}} \
129+
// ref-note {{indeterminate value can only initialize an object of type}}
130+
}
131+
125132
namespace BitFields {
126133
struct BitFields {
127134
unsigned a : 2;

0 commit comments

Comments
 (0)