blob: 2997fa1cf52f5f4769928323ca745f8e7676968e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
// 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];
}
|