re PR c/65471 (type interpretation in _Generic)
authorMarek Polacek <polacek@redhat.com>
Thu, 9 Jun 2016 10:16:19 +0000 (10:16 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Thu, 9 Jun 2016 10:16:19 +0000 (10:16 +0000)
PR c/65471
* gcc.dg/c11-generic-3.c: New test.

From-SVN: r237252

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/c11-generic-3.c [new file with mode: 0644]

index ab6395e905184ccac8e1c8be2f08ca235310f10f..844f0f5e0c7680e343374e86e12887ec953ccedd 100644 (file)
@@ -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 (file)
index 0000000..8bac21e
--- /dev/null
@@ -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" } */