view gcc/testsuite/g++.dg/cpp2a/constexpr-init14.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

// PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.
// { dg-do compile { target c++2a } }

struct E {
  constexpr E() = default;
  constexpr E(int) {}
};

struct W {
  [[no_unique_address]] E e;
  constexpr W(int) : e(8) {}
};

constexpr W w = W(42);

struct S {
  E e;
  constexpr S() : e{} { }
};

constexpr S s;

struct S2 {
  [[no_unique_address]] E e;
  constexpr S2() : e{} { }
};

constexpr S2 s2;