aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2016-06-09 10:16:19 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2016-06-09 10:16:19 +0000
commit7d82e8e465d2466e0aab64bbaf442bfc79cb891e (patch)
treed363c118823af64c04e7501ede054c53a3d46405
parentbd8099f9de347166521150290621f6fa2236a12a (diff)
downloadgcc-7d82e8e465d2466e0aab64bbaf442bfc79cb891e.zip
gcc-7d82e8e465d2466e0aab64bbaf442bfc79cb891e.tar.gz
gcc-7d82e8e465d2466e0aab64bbaf442bfc79cb891e.tar.bz2
re PR c/65471 (type interpretation in _Generic)
PR c/65471 * gcc.dg/c11-generic-3.c: New test. From-SVN: r237252
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/c11-generic-3.c10
2 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ab6395e..844f0f5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-06-09 Marek Polacek <polacek@redhat.com>
+
+ PR c/65471
+ * gcc.dg/c11-generic-3.c: New test.
+
2016-06-08 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/init/array42.C: New.
diff --git a/gcc/testsuite/gcc.dg/c11-generic-3.c b/gcc/testsuite/gcc.dg/c11-generic-3.c
new file mode 100644
index 0000000..8bac21e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-generic-3.c
@@ -0,0 +1,10 @@
+/* Test C11 _Generic. Test we follow the resolution of DR#423. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+char const *a = _Generic ("bla", char *: "");
+char const *b = _Generic ("bla", char[4]: ""); /* { dg-error "not compatible with any association" } */
+char const *c = _Generic ((int const) { 0 }, int: "");
+char const *d = _Generic ((int const) { 0 }, int const: ""); /* { dg-error "not compatible with any association" } */
+char const *e = _Generic (+(int const) { 0 }, int: "");
+char const *f = _Generic (+(int const) { 0 }, int const: ""); /* { dg-error "not compatible with any association" } */