[cfe-dev] no diagnostic when template argument is a reference to array of unknown bound

victor.zverovich at gmail.com victor.zverovich at gmail.com
Wed Jul 9 09:30:33 PDT 2014


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?

I'm using clang version 3.5-1ubuntu1.

Thanks,
Victor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140709/2c13a8e1/attachment.html>


More information about the cfe-dev mailing list