diff mbox series

[1/5] gensel: add testcases from DR481

Message ID 20200619150300.63695-2-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series Fixes for generic selection | expand

Commit Message

Luc Van Oostenryck June 19, 2020, 3:02 p.m. UTC
Following the resolution of DR481, the controlling expression
is subject to a few different rules.

Add the testcases from this defect report.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 validation/generic-dr481.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 validation/generic-dr481.c
diff mbox series

Patch

diff --git a/validation/generic-dr481.c b/validation/generic-dr481.c
new file mode 100644
index 000000000000..2ed15c9bc6d3
--- /dev/null
+++ b/validation/generic-dr481.c
@@ -0,0 +1,17 @@ 
+static char const* a = _Generic("bla", char*: "blu");
+static char const* b = _Generic("bla", char[4]: "blu");
+static char const* c = _Generic((int const){ 0 }, int: "blu");
+static char const* d = _Generic((int const){ 0 }, int const: "blu");
+static char const* e = _Generic(+(int const){ 0 }, int: "blu");
+static char const* f = _Generic(+(int const){ 0 }, int const: "blu");
+
+/*
+ * check-name: generic-dr481
+ * check-known-to-fail
+ *
+ * check-error-start
+generic-dr481.c:2:32: error: no generic selection for 'char *'
+generic-dr481.c:4:32: error: no generic selection for 'int const [toplevel]'
+generic-dr481.c:6:32: error: no generic selection for 'int'
+ * check-error-end
+ */