view gcc/testsuite/g++.dg/pr60517.C @ 152:2b5abeee2509

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

// PR c++/60517 - warning/error for taking address of member of a temporary
// object
// { dg-do compile }

class B
{
public:
  double x[2];
};

class A
{
  B b;
public:
  B getB () { return b; }
};

double foo (A a)
{
  double * x = &(a.getB().x[0]);   // { dg-error "taking address of rvalue" }
  return x[0];
}