view gcc/testsuite/g++.dg/cpp0x/constexpr-trivial1.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// PR c++/70139
// { dg-options "-fno-elide-constructors" }
// { dg-do compile { target c++11 } }

template<class T, class U>
struct A
{
  T a;
  U b;
  constexpr A () : a (), b () { }
  constexpr A (const T &x, const U &y) : a (x), b (y) { }
};
struct B
{
  constexpr B (const bool x) : c (x) {}
  constexpr bool operator!= (const B x) const { return c != x.c; }
  bool c;
};
constexpr static A<B, B*> d[] = { { B (true), nullptr }, { B (false), nullptr } };
static_assert (d[0].a != d[1].a, "");