summaryrefslogtreecommitdiff
path: root/gcc/testsuite/obj-c++.dg/warn5.mm
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/obj-c++.dg/warn5.mm')
-rw-r--r--gcc/testsuite/obj-c++.dg/warn5.mm25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/obj-c++.dg/warn5.mm b/gcc/testsuite/obj-c++.dg/warn5.mm
new file mode 100644
index 000000000..5f9b7a7f7
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/warn5.mm
@@ -0,0 +1,25 @@
+/* Check to make sure that a c++ program compiled in objective-c++ mode
+ has no trace of meta-data specific diagnosis coming out of compiling it.
+ This is replicate of warn5.C.
+*/
+// { dg-do assemble }
+// { dg-options "-Wpointer-arith" }
+
+double X(const double x) { return x; }
+double Y() { return 1.0; }
+double Z() { return 2.0; }
+
+struct A {
+ void bar() { }
+ void foo() { }
+};
+
+typedef void (A::*pmf)();
+
+static int mememe = &A::foo - &A::bar; // { dg-error "" }
+pmf b = &A::foo-1; // { dg-error "" }
+
+int main() {
+ double y;
+ y=X(Y-Z); // { dg-error "" }
+}