view gcc/testsuite/g++.dg/cpp1y/constexpr-nsdmi6b.C @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
children
line wrap: on
line source

// PR c++/94034
// { dg-do compile { target c++14 } }

struct A {
  A() = default; A(const A&);
  A *ap = this;
};

constexpr A foo()
{
  return {};
}

constexpr A bar()
{
  return foo();
}

void
baz()
{
  constexpr A a = foo(); // { dg-error ".A..& a... is not a constant expression" }
  constexpr A b = bar(); // { dg-error ".A..& b... is not a constant expression" }
}

constexpr A a = foo();
constexpr A b = bar();