[cfe-commits] r59605 - /cfe/trunk/include/clang/Basic/IdentifierTable.h

Sebastian Redl sebastian.redl at getdesigned.at
Wed Nov 19 08:21:17 PST 2008


Chris Lattner wrote:
> Author: lattner
> Date: Wed Nov 19 01:49:14 2008
> New Revision: 59605
>
> URL: http://llvm.org/viewvc/llvm-project?rev=59605&view=rev
> Log:
> add a new helper method.  It is unclear to me why this doesn't work, but GCC
> won't match it:
>
>   template<std::size_t StrLen>
>   bool isName(const char Str[StrLen]) const {
>     return getLength() == StrLen-1 && !memcmp(getName(), Str, StrLen-1);
>   }
>   
Because it's meaningless. A parameter of array type always decays. To 
actually pass an array, you have to make it a reference:

template <std::size_t StrLen>
bool isName(const char (&Str)[StrLen]) const

Sebastian



More information about the cfe-commits mailing list