aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/attr-may-alias-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/c-c++-common/attr-may-alias-2.c')
-rw-r--r--gcc/testsuite/c-c++-common/attr-may-alias-2.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/attr-may-alias-2.c b/gcc/testsuite/c-c++-common/attr-may-alias-2.c
new file mode 100644
index 0000000..44ea926
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-may-alias-2.c
@@ -0,0 +1,17 @@
+/* We used to reject this because types differentiating only in
+ TYPE_REF_CAN_ALIAS_ALL were deemed incompatible. */
+/* { dg-do compile } */
+
+struct sockaddr;
+struct sockaddr *f (void);
+
+struct __attribute__((may_alias)) sockaddr { int j; };
+struct sockaddr *
+f (void)
+{
+ return
+#ifndef __cplusplus
+ (void *)
+#endif
+ 0;
+}