On Sat, Jan 11, 2025 at 08:25:32PM +0100, Jakub Jelinek wrote:
> That is not true.

Implementation-wise, in C17 say
void foo ();
void bar (void);
TYPE_ARG_TYPES (TREE_TYPE (foo_decl)) == NULL
TYPE_ARG_TYPES (TREE_TYPE (bar_decl)) == void_list_node
but in C23 both have TYPE_ARG_TYPES void_list_node, actually even
TREE_TYPE (foo_decl) == TREE_TYPE (bar_decl).

So, if you want to actually point out in diagnostics the difference
(because it makes no sense to talk about some C23 change for code which
wouldn't be valid in C17 either, say
void (*fp) (void);
void fn (int, int);
...
  fp = fn;
)
we'd need to remember in the function type (some flag on it) whether it
would be the unspecified arguments case in C17 and earlier or not.
But such flag can't affect type compatibility etc., it should be there
just for diagnostic purposes only.
And on declaration merging,
void foo ();
void foo ();
should result in the flag still being used on the resulting function type,
but
void foo (void);
void foo ();
or
void foo ();
void foo (void);
shouldn't have it on the resulting function type.

        Jakub

Reply via email to