aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/c1x-pointer-float-1.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2011-08-18 22:59:20 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2011-08-18 22:59:20 +0100
commita7ad08aef73fd2c4219a31a419e41ce2e5408a09 (patch)
treea65235d871380f8d007242a605fcc4e8a0546084 /gcc/testsuite/gcc.dg/c1x-pointer-float-1.c
parent4ee3237e0b5796d047d0b9f01fbe0277ff14d083 (diff)
downloadgcc-a7ad08aef73fd2c4219a31a419e41ce2e5408a09.zip
gcc-a7ad08aef73fd2c4219a31a419e41ce2e5408a09.tar.gz
gcc-a7ad08aef73fd2c4219a31a419e41ce2e5408a09.tar.bz2
* gcc.dg/c1x-pointer-float-1.c: New test.
From-SVN: r177884
Diffstat (limited to 'gcc/testsuite/gcc.dg/c1x-pointer-float-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/c1x-pointer-float-1.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/c1x-pointer-float-1.c b/gcc/testsuite/gcc.dg/c1x-pointer-float-1.c
new file mode 100644
index 0000000..57c5be8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c1x-pointer-float-1.c
@@ -0,0 +1,28 @@
+/* Test C1X constraint against pointer / floating-point casts. */
+/* { dg-do compile } */
+/* { dg-options "-std=c1x -pedantic-errors" } */
+
+void *p;
+float f;
+double d;
+long double ld;
+_Complex float cf;
+_Complex double cd;
+_Complex long double cld;
+
+void
+func (void)
+{
+ f = (float) p; /* { dg-error "pointer" } */
+ d = (double) p; /* { dg-error "pointer" } */
+ ld = (long double) p; /* { dg-error "pointer" } */
+ cf = (_Complex float) p; /* { dg-error "pointer" } */
+ cd = (_Complex double) p; /* { dg-error "pointer" } */
+ cld = (_Complex long double) p; /* { dg-error "pointer" } */
+ p = (void *) f; /* { dg-error "pointer" } */
+ p = (void *) d; /* { dg-error "pointer" } */
+ p = (void *) ld; /* { dg-error "pointer" } */
+ p = (void *) cf; /* { dg-error "pointer" } */
+ p = (void *) cd; /* { dg-error "pointer" } */
+ p = (void *) cld; /* { dg-error "pointer" } */
+}