blob: 476e16ad2367f54e4eba8da4bed8117d2f907d04 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
class P { public: virtual int val() { return 123; } };
class Psub : public P { };
extern int sink1, sink2;
void test() {
Psub p;
P &pRef = p;
sink1 = p.val();
sink2 = pRef.val();
}
inline int v(P &p) { return p.val(); }
void testInlineP() {
P p;
sink1 = v(p);
}
void testInlinePsub() {
Psub p;
sink1 = v(p);
}
// { dg-final { scan-tree-dump-not "OBJ_TYPE_REF" "optimized" { xfail *-*-* } } }
// { dg-final { cleanup-tree-dump "optimized" } }
|