summaryrefslogtreecommitdiffstats
path: root/contrib/netbsd-tests/usr.bin/xlint/lint1/d_type_question_colon.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/netbsd-tests/usr.bin/xlint/lint1/d_type_question_colon.c')
-rw-r--r--contrib/netbsd-tests/usr.bin/xlint/lint1/d_type_question_colon.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/contrib/netbsd-tests/usr.bin/xlint/lint1/d_type_question_colon.c b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_type_question_colon.c
new file mode 100644
index 0000000..00f69cd
--- /dev/null
+++ b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_type_question_colon.c
@@ -0,0 +1,14 @@
+/* the type of the ?: expression should be the more specific type */
+
+struct foo {
+ int bar;
+};
+
+void
+test(void) {
+ int i;
+ struct foo *ptr = 0;
+
+ for (i = (ptr ? ptr : (void *)0)->bar; i < 10; i++)
+ test();
+}
OpenPOWER on IntegriCloud