https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65455

--- Comment #19 from joseph at codesourcery dot com <joseph at codesourcery dot 
com> ---
On Thu, 13 Aug 2015, mpolacek at gcc dot gnu.org wrote:

> So this looks like a dup of PR39985.  It seems that, if anything, we should
> modify __typeof to drop all qualifiers.  I.e. that all of the following
> __typeofs yield "int":

Yes, I think so as a matter of language design, but there is a risk to 
existing code (that declares aliases, for example) and there may be a use 
for a new typeof variant that always returns the declared type when passed 
an lvalue.

Minimally and probably more safely, __typeof should drop all qualifiers on 
rvalues (including those returned by functions returning qualified type, 
or resulting from cast to qualified type; note that the proposed 
resolution to DR#423 would require changes to remove the qualifiers from 
function return types so that "const int foo(int);" and "int foo(int);" 
are compatible declarations, which would probably be safest if only done 
for C11 and above).

Reply via email to