aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/lto/v1-plugin-api-not-supported_0.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/lto/v1-plugin-api-not-supported_0.C')
-rw-r--r--gcc/testsuite/g++.dg/lto/v1-plugin-api-not-supported_0.C54
1 files changed, 54 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/lto/v1-plugin-api-not-supported_0.C b/gcc/testsuite/g++.dg/lto/v1-plugin-api-not-supported_0.C
new file mode 100644
index 000000000..f79dfae5c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/v1-plugin-api-not-supported_0.C
@@ -0,0 +1,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;
+}