aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/pr84943-2.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/pr84943-2.C')
-rw-r--r--gcc/testsuite/g++.dg/pr84943-2.C64
1 files changed, 64 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/pr84943-2.C b/gcc/testsuite/g++.dg/pr84943-2.C
new file mode 100644
index 00000000000..d1ef012b915
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr84943-2.C
@@ -0,0 +1,64 @@
+// { dg-do run }
+
+// Avoid -pedantic-error default
+// { dg-options "" }
+
+// Make sure the functions referenced by various forms of
+// address-taking are marked as used and compiled in.
+
+static void ac() {}
+void a() {
+ ac[0](); // { dg-warning "arithmetic" }
+}
+
+static void bc() {}
+void b() {
+ (&*&*&*&bc)();
+}
+
+template <typename U> U cc() {}
+void (*c())() {
+ return cc;
+}
+
+template <typename T>
+struct x {
+ void a(int);
+ template <typename U> static U a(x*) {}
+ static void a(long) {}
+ static void a(void *) {}
+ static void a() {
+ void (*p0)(void*) = x().a;
+ p0(0);
+ void (*p1)(long) = a;
+ p1(0);
+ void (*p2)() = a;
+ p2();
+ void (*p3)(x*) = a;
+ p3(0);
+ }
+};
+
+struct z {
+ void a(int);
+ template <typename U> static U a(z*) {}
+ static void a(long) {}
+ static void a(void *) {}
+ static void a() {
+ void (*p0)(void*) = z().a;
+ p0(0);
+ void (*p1)(long) = a;
+ p1(0);
+ void (*p2)() = a;
+ p2();
+ void (*p3)(z*) = a;
+ p3(0);
+ }
+};
+
+int main(int argc, char *argv[]) {
+ if (argc > 1) {
+ x<void>().a();
+ z().a();
+ }
+}