PR c++/60517 - warning/error for taking address of member of a temporary object
testsuite/ChangeLog: * g++.dg/pr60517.C: New test. From-SVN: r274130
This commit is contained in:
parent
0598953368
commit
57436cb10e
@ -1,3 +1,8 @@
|
||||
2019-08-05 Martin Sebor <msebor@redhat.com>
|
||||
|
||||
PR c++/60517
|
||||
* g++.dg/pr60517.C: New test.
|
||||
|
||||
2019-08-02 Tom Honermann <tom@honermann.net>
|
||||
|
||||
PR c++/88095
|
||||
|
22
gcc/testsuite/g++.dg/pr60517.C
Normal file
22
gcc/testsuite/g++.dg/pr60517.C
Normal file
@ -0,0 +1,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];
|
||||
}
|
Loading…
Reference in New Issue
Block a user