aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/obj-c++.dg/encode-3.mm
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/obj-c++.dg/encode-3.mm')
-rw-r--r--gcc/testsuite/obj-c++.dg/encode-3.mm31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/obj-c++.dg/encode-3.mm b/gcc/testsuite/obj-c++.dg/encode-3.mm
new file mode 100644
index 00000000000..628befc4a1e
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/encode-3.mm
@@ -0,0 +1,31 @@
+/* APPLE LOCAL file Objective-C++ */
+/* { dg-do run } */
+
+#include <stdlib.h>
+#include <string.h>
+
+template <class T>
+struct Vec {
+ T x, y;
+ long z;
+ long long zz;
+};
+
+Vec<double> dd;
+const char *enc = @encode(Vec<float>);
+const char *enc2 = @encode(Vec<double>);
+
+int main(void) {
+ char *encode = @encode(long);
+
+ if (strcmp (encode, "l"))
+ abort();
+
+ if (strcmp (enc, "{Vec<float>=fflq}"))
+ abort();
+
+ if (strcmp (enc2, "{Vec<double>=ddlq}"))
+ abort();
+
+ return 0;
+}