@@ -287,7 +287,7 @@ struct int_splicer {
287287
288288constexpr int_splicer splice (0x0C05FEFE , 0xCAFEBABE );
289289
290- #if 0
290+ #if 1
291291static_assert (bit_cast<unsigned long long >(splice) == (LITTLE_END
292292 ? 0xCAFEBABE0C05FEFE
293293 : 0x0C05FEFECAFEBABE ));
@@ -297,8 +297,8 @@ static_assert(bit_cast<int_splicer>(0xCAFEBABE0C05FEFE).x == (LITTLE_END
297297 ? 0x0C05FEFE
298298 : 0xCAFEBABE ));
299299
300- static_assert(round_trip <unsigned long long>(splice));
301- static_assert(round_trip <long long>(splice));
300+ static_assert (check_round_trip <unsigned long long >(splice));
301+ static_assert (check_round_trip <long long >(splice));
302302#endif
303303
304304
@@ -340,13 +340,12 @@ void test_record() {
340340 ? 0xCAFEBABE0C05FEFE
341341 : 0x0C05FEFECAFEBABE ));
342342
343- // / FIXME: Bit casts to composite types.
344- // static_assert(bit_cast<int_splicer>(0xCAFEBABE0C05FEFE).x == (LITTLE_END
345- // ? 0x0C05FEFE
346- // : 0xCAFEBABE));
343+ static_assert (bit_cast<int_splicer>(0xCAFEBABE0C05FEFE ).x == (LITTLE_END
344+ ? 0x0C05FEFE
345+ : 0xCAFEBABE ));
347346
348- // static_assert(check_round_trip<unsigned long long>(splice));
349- // static_assert(check_round_trip<long long>(splice));
347+ static_assert (check_round_trip<unsigned long long >(splice));
348+ static_assert (check_round_trip<long long >(splice));
350349
351350 struct base2 {
352351 };
@@ -368,13 +367,14 @@ void test_record() {
368367 z == other.z && doublez == other.doublez ;
369368 }
370369 };
371- // constexpr bases b = {{1, 2}, {}, {3}, 4};
372- // constexpr tuple4 t4 = bit_cast<tuple4>(b);
373- // static_assert(t4 == tuple4{1, 2, 3, 4});
374- // static_assert(round_trip<tuple4>(b));
375-
376- // constexpr auto b2 = bit_cast<bases>(t4);
377- // static_assert(t4 == b2);
370+ constexpr bases b = {{1 , 2 }, {}, {3 }, 4 };
371+ constexpr tuple4 t4 = bit_cast<tuple4>(b);
372+ static_assert (t4 == tuple4{1 , 2 , 3 , 4 });
373+ static_assert (check_round_trip<tuple4>(b));
374+
375+ // / FIXME: We need to initialize the base pointers in the pointer we're bitcasting to.
376+ // constexpr auto b2 = bit_cast<bases>(t4);
377+ // static_assert(t4 == b2);
378378}
379379
380380void test_partially_initialized () {
@@ -411,16 +411,16 @@ void bad_types() {
411411 };
412412 static_assert (__builtin_bit_cast (int , X{0 }) == 0 ); // both-error {{not an integral constant expression}} \
413413 // both-note {{bit_cast from a union type is not allowed in a constant expression}}
414- #if 0
414+ #if 1
415415
416416 struct G {
417417 int g;
418418 };
419- // expected -error@+2 {{constexpr variable 'g' must be initialized by a constant expression}}
420- // expected -note@+1 {{bit_cast from a union type is not allowed in a constant expression}}
419+ // both -error@+2 {{constexpr variable 'g' must be initialized by a constant expression}}
420+ // both -note@+1 {{bit_cast from a union type is not allowed in a constant expression}}
421421 constexpr G g = __builtin_bit_cast (G, X{0 });
422- // expected -error@+2 {{constexpr variable 'x' must be initialized by a constant expression}}
423- // expected -note@+1 {{bit_cast to a union type is not allowed in a constant expression}}
422+ // both -error@+2 {{constexpr variable 'x' must be initialized by a constant expression}}
423+ // both -note@+1 {{bit_cast to a union type is not allowed in a constant expression}}
424424 constexpr X x = __builtin_bit_cast (X, G{0 });
425425#endif
426426 struct has_pointer {
0 commit comments