[cfe-dev] bug with USRs and fixed-length arrays?

Iestyn Bleasdale-Shepherd iestyn at valvesoftware.com
Fri Nov 2 11:49:41 PDT 2012


Hi Dmitri - thanks for the response!

The line you quote ends with "...where the type qualifiers (if any) are those specified within the [ and ] of the array type derivation."

This qualification allows disambiguation between my two example functions - as it must, since they may have completely different implementations and may be passed as different function pointers.

Am I missing something here? We use these kinds of overloads in our code, in cases which depend on their resolving to *different* functions.

Thanks,

iestyn


-----Original Message-----
From: Dmitri Gribenko [mailto:gribozavr at gmail.com] 
Sent: Friday, November 02, 2012 11:00 AM
To: Iestyn Bleasdale-Shepherd
Cc: cfe-dev at cs.uiuc.edu
Subject: Re: [cfe-dev] bug with USRs and fixed-length arrays?

On Fri, Nov 2, 2012 at 7:55 PM, Iestyn Bleasdale-Shepherd
<iestyn at valvesoftware.com> wrote:
> Hi,
>
> The strings returned by clang_getCursorUSR represent fixed-length arrays as
> pointers, so the USRs for "void Func( char[16] )" and "void "Func( char[32]
> )" are identical and thus ambiguous.

Hi Iestyn,

These two decls are just redeclarations of one function -- see C11 6.7.6.3p7:

A declaration of a parameter as ‘‘array of type’’ shall be adjusted to
‘‘qualified pointer to type’’ [...]

So in my opinion there is no reason for them to have different USRs.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/




More information about the cfe-dev mailing list