How to trigger "'void' must be the only parameter and unnamed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

There's the following error:

$ grep -C5 'must be the only parameter and unnamed' gcc/c/c-decl.cc 
	  else if (VOID_TYPE_P (type))
	    {
	      if (!gave_void_only_once_err)
		{
		  error_at (b->locus,
			    "%<void%> must be the only parameter and unnamed");
		  gave_void_only_once_err = true;
		}
	    }
	  else
	    {

Which I seem to be unable to trigger.

	alx@devuan:~/tmp$ cat voidp.c | nl
	     1	void f(void v);
	     2	void g(void v, int y);
	     3	void h(int y, void);
	alx@devuan:~/tmp$ gcc voidp.c 
	voidp.c:1:13: warning: parameter 1 (‘v’) has void type
	    1 | void f(void v);
	      |        ~~~~~^
	voidp.c:2:13: warning: parameter 1 (‘v’) has void type
	    2 | void g(void v, int y);
	      |        ~~~~~^
	voidp.c:3:15: error: ‘void’ must be the only parameter
	    3 | void h(int y, void);
	      |               ^~~~

I expect both lines 1 and 2 would trigger this error.  Am I missing
something?


Have a lovely day!
Alex

-- 
<https://www.alejandro-colomar.es/>

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux