[llvm-commits] [llvm] r135391 - /llvm/trunk/include/llvm/ADT/ArrayRef.h

David Blaikie dblaikie at gmail.com
Mon Jul 18 07:28:04 PDT 2011


>
>   template<typename T, size_t N>
>   ArrayRef<T> makeArrayRef(const T (&Arr)[N]) {
> -    return Arr;
> +    return ArrayRef<T>(Arr, N);
>   }
>

If you're going to implement this specialization this way you could probably
just remove the ArrayRef(const T(&)[N]) ctor entirely since no one
should/will ever use it. Alternatively would "return ArrayRef<T>(Arr)" avoid
the pointer degeneration? (& if that ctor doesn't work correctly (even if
it's just because of a misimplementation* on a mainstream compiler)
implicitly, should we just mark it explicit to be on the safe side?)

* is this a bug in GCC? filed somewhere?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110718/2acb5579/attachment.html>


More information about the llvm-commits mailing list