[cfe-dev] no diagnostic when template argument is a reference to array of unknown bound
Richard Smith
richard at metafoo.co.uk
Wed Jul 16 15:10:23 PDT 2014
On Wed, Jul 9, 2014 at 9:30 AM, victor.zverovich at gmail.com <
victor.zverovich at gmail.com> wrote:
> Hello,
>
> The following code compiles without warnings or errors with clang++ -Wall
> -pedantic:
>
> template <typename T>
> void f(const T&) {}
>
> extern char test[];
>
> int main() {
> f(test);
> }
>
> char test[] = "";
>
>
> However, quoting C++11 8.3.5-8
> <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3376.pdf#page=196>
> :
>
> If the type of a parameter includes a type of the form “pointer to array
>> of unknown bound of T” or “reference to array of unknown bound of T,” the
>> program is ill-formed.9
>
>
> So shouldn't clang gives at least a warning because the template parameter
> type in the example above is a reference to an array of unknown bound?
>
Clang implements the proposed resolution to this C++ core language bug:
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#393
> I'm using clang version 3.5-1ubuntu1.
>
> Thanks,
> Victor
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140716/edbd8137/attachment.html>
More information about the cfe-dev
mailing list