Debian Codegraph @

gcc/testsuite/g++.dg/pr60517.C

raw
1 // PR c++/60517 - warning/error for taking address of member of a temporary
2 // object
3 // { dg-do compile }
4
5 class B
6 {
7 public:
8 double x[2];
9 };
10
11 class A
12 {
13 B b;
14 public:
15 B getB () { return b; }
16 };
17
18 double foo (A a)
19 {
20 double * x = &(a.getB().x[0]); // { dg-error "taking address of rvalue" }
21 return x[0];
22 }