blob: f79dfae5c6f69ce661a55f9016f9e787188872c3 (
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
// { dg-lto-do run }
// { dg-require-linker-plugin "" }
// { dg-lto-options {{-O2 -fuse-linker-plugin -fno-early-inlining}}
extern "C" void abort (void);
extern "C" void linker_error ();
class A
{
public:
int data;
virtual int foo (int i)
{
return i + 1;
}
};
class B : public A
{
public:
virtual int foo (int i)
{
return i + 2;
}
};
class C : public A
{
public:
virtual int foo (int i)
{
linker_error ();
return i + 3;
}
};
static int middleman (class A *obj, int i)
{
return obj->foo (i);
}
int __attribute__ ((noinline,noclone)) get_input(void)
{
return 1;
}
int main (int argc, char *argv[])
{
class B b;
if (middleman (&b, get_input ()) != 3)
abort ();
return 0;
}
|