[cfe-commits] r149685 - in /cfe/trunk: lib/Sema/SemaTemplate.cpp test/CXX/temp/temp.decls/temp.variadic/fixed-expansion.cpp

Richard Smith richard at metafoo.co.uk
Fri Feb 3 00:47:58 PST 2012


On Thu, Feb 2, 2012 at 11:34 PM, Douglas Gregor <dgregor at apple.com> wrote:

> Author: dgregor
> Date: Fri Feb  3 01:34:46 2012
> New Revision: 149685
>
> URL: http://llvm.org/viewvc/llvm-project?rev=149685&view=rev
> Log:
> Implement support for a pack expansion into a fixed-length
> template. Such pack expansions can easily fail at template
> instantiation time, if the expanded parameter packs are of the wrong
> length. Fixes <rdar://problem/10040867>, PR9021, and the example that
> came up today at Going Native.
>

Awesome!

I note we now accept:

template<typename,typename,typename> struct S {};
template<typename T, typename U> using U = S<T, int, U>;
template<typename...Ts> int f(U<Ts...>, Ts...);
int k = f({}, 0, 0);

... which should probably be considered invalid (see the thread on the core
reflector starting with message 20878).

[Incidentally, we mangle that as

  _Z1fIJiiEEi1SIDpT_iT0_ES2_

which looks like

  template<typename ...Ts = {int,int}> int f(S<Ts..., int, U>, Ts...);

(where U is a nonexistent second template parameter). I've not been able to
trigger a mangling like that without using one of these non-substitutable
alias templates.]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120203/678625ab/attachment.html>


More information about the cfe-commits mailing list