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
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to