summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.pt/local7.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.pt/local7.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/local7.C23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/local7.C b/gcc/testsuite/g++.old-deja/g++.pt/local7.C
new file mode 100644
index 000000000..96b19fc64
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/local7.C
@@ -0,0 +1,23 @@
+// { dg-do assemble }
+
+template <class STRUCT, class MEMBER> inline STRUCT *
+setback(MEMBER *bp, MEMBER STRUCT::*offset)
+{
+ if(!bp) return 0;
+ union { int i; MEMBER STRUCT::*of; } u;
+ u.of = offset;
+ return (STRUCT *) ((__SIZE_TYPE__) bp - u.i);
+}
+
+
+struct S
+{
+ int i;
+};
+
+int main()
+{
+ S s;
+
+ S* sp = setback (&s.i, &S::i);
+}