msg_204.c revision 1.2
1/*	$NetBSD: msg_204.c,v 1.2 2021/01/08 01:40:03 rillig Exp $	*/
2# 3 "msg_204.c"
3
4// Test for message: controlling expressions must have scalar type [204]
5
6extern void
7extern_function(void);
8
9void (*function_pointer)(void);
10
11/*
12 * Since func.c 1.39 from 2020-12-31 18:51:28, lint had produced an error
13 * when a controlling expression was a function.  Pointers to functions were
14 * ok though.
15 */
16void
17bug_between_2020_12_31_and_2021_01_08(void)
18{
19	if (extern_function)
20		extern_function();
21
22	/*
23	 * FIXME: For some reason, the ampersand is discarded in
24	 *  build_ampersand.  This only has a visible effect if the
25	 *  t_spec in check_controlling_expression is evaluated too early,
26	 *  as has been the case before func.c 1.52 from 2021-01-08.
27	 */
28	if (&extern_function)
29		extern_function();
30
31	/* This one has always been ok since pointers are scalar types. */
32	if (function_pointer)
33		function_pointer();
34}
35