[Bug c/15052] gcc frontend accepts mismatched function declaration/defintion

jsm at polyomino dot org dot uk gcc-bugzilla@gcc.gnu.org
Thu Apr 22 10:20:00 GMT 2004


------- Additional Comments From jsm at polyomino dot org dot uk  2004-04-22 09:08 -------
Subject: Re:  gcc frontend accepts mismatched function
 declaration/defintion

On Wed, 21 Apr 2004, bangerth at dealii dot org wrote:

> I would argue that this is the same reasoning that we accept 
>   void f (int); 
>   void f (const int i) {...} 

No, that's specific wording in 6.7.5.3#15 that type qualifiers on 
parameters are ignored in determining compatibility.  There is no such 
wording about qualifiers on return types.  They are *semantically* ignored 
- as functions only return rvalues, so the user won't get any useful 
effect of qualifiers on return types - but still form part of the type 
that is to be checked.  The prohibition on qualified void return types is 
from 6.9.1#3 ("The return type of a function shall be void or an object 
type other than array type." - which doesn't permit qualified void).



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15052



More information about the Gcc-bugs mailing list