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

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

FYI I discovered another USR error case and have added that to the bug too (is that reasonable, or is it preferred to split into multiple bugs?).

In this error case, the representation of function pointer types is too terse; there needs to be a terminator after the parameter list to avoid ambiguity. Here's my simple repro example:

  typedef void (*FuncPtrA_)();
  typedef void (*FuncPtrB_)( int );
  typedef FuncPtrA_ (*FuncPtrA)( int );
  typedef FuncPtrB_ (*FuncPtrB)();
  void Func( FuncPtrA ) {} // c:@F at Func#*F*FvI#
  void Func( FuncPtrB ) {} // c:@F at Func#*F*FvI#


-----Original Message-----
From: cfe-dev-bounces at cs.uiuc.edu [mailto:cfe-dev-bounces at cs.uiuc.edu] On Behalf Of Iestyn Bleasdale-Shepherd
Sent: Friday, November 02, 2012 1:10 PM
To: 'Dmitri Gribenko'
Cc: 'cfe-dev at cs.uiuc.edu'
Subject: Re: [cfe-dev] bug with USRs and fixed-length arrays?

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

Thankyou, sirs!


-----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:



(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/

cfe-dev mailing list
cfe-dev at cs.uiuc.edu

More information about the cfe-dev mailing list