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

Iestyn Bleasdale-Shepherd iestyn at valvesoftware.com
Fri Nov 2 13:09:31 PDT 2012


Okiedoke. I have updated the associated bug (http://llvm.org/bugs/show_bug.cgi?id=13575) with this new example.

Thankyou, sirs!

iestyn


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

On Fri, Nov 2, 2012 at 9:37 PM, Iestyn Bleasdale-Shepherd
<iestyn at valvesoftware.com> wrote:
> Ah, you are right! There is an extra ingredient in our usage cases:
> templates*
>
> For example, we use templates to implement ‘safe’ string functions which use
> the type of the destination buffer (a fixed-length character array) as the
> template parameter, rather than passing in the array size as a function
> parameter (which is error-prone – array size sometimes being confused with
> array length, for multi-byte characters).
>
> However, here are the USRs that I get in a templatized example case:
>
> template <class buffer> void mystrlwr( buffer &dst );                     //
> c:@FT@>1#Tmystrlwr#&t0.0#
>
> template <> void mystrlwr<char[16]>( char (&dst)[16] );
> // c:@F at mystrlwr<# >#&S0_#
>
> template <> void mystrlwr<char[32]>( char (&dst)[32] );
> // c:@F at mystrlwr<# >#&S0_#
>
> template <> void mystrlwr<char[64]>( char (&dst)[64] );
> // c:@F at mystrlwr<# >#&S0_#
>
> Here, the type buffer type gets reduced to “ “ as a template parameter and
> “S0_” as a function parameter.

I see.  This was actually discussed previously:

http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-August/023628.html

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