aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/bit-cast9.C
blob: bf3d368418f0e9dc55c79b31e8a406bde7a9c4a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// PR c++/98469
// { dg-do compile { target c++20 } }
// { dg-options "-Wall" }

template<typename T, typename F>
constexpr T
bit_cast (const F &f) noexcept
{
  return __builtin_bit_cast (T, f);
}
struct S { int s; };
constexpr int foo (const S &x) { return x.s; }
constexpr int bar () { return foo (bit_cast<S> (0)); }
constexpr int x = bar ();
static_assert (!x);