<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 3, 2012, at 12:47 AM, Richard Smith wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="gmail_quote">On Thu, Feb 2, 2012 at 11:34 PM, Douglas Gregor <span dir="ltr"><<a href="mailto:dgregor@apple.com" target="_blank">dgregor@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Author: dgregor<br>
Date: Fri Feb  3 01:34:46 2012<br>
New Revision: 149685<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=149685&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=149685&view=rev</a><br>
Log:<br>
Implement support for a pack expansion into a fixed-length<br>
template. Such pack expansions can easily fail at template<br>
instantiation time, if the expanded parameter packs are of the wrong<br>
length. Fixes <<a href="rdar://problem/10040867">rdar://problem/10040867</a>>, PR9021, and the example that<br>
came up today at Going Native.<br></blockquote><div> </div><div>Awesome!</div><div><br></div><div>I note we now accept:</div><div><br></div><div>template<typename,typename,typename> struct S {};</div><div>template<typename T, typename U> using U = S<T, int, U>;</div>
<div>template<typename...Ts> int f(U<Ts...>, Ts...);</div><div>int k = f({}, 0, 0);</div><div><br></div><div>... which should probably be considered invalid (see the thread on the core reflector starting with message 20878).</div></div></blockquote><div><br></div><div>Nice catch. Personally, I think it should be well-formed. I've gone ahead and implemented it in r149697; if the discussion next week goes the other way, it's simple enough to revert my change and reject this code (but I don't like it in the intermediate state where it accepts + mangles poorly).</div><br><blockquote type="cite"><div class="gmail_quote"><div>[Incidentally, we mangle that as</div><div><br></div><div>  _Z1fIJiiEEi1SIDpT_iT0_ES2_</div><div><br></div><div>which looks like</div><div><br></div><div>  template<typename ...Ts = {int,int}> int f(S<Ts..., int, U>, Ts...);</div>
<div><br></div><div>(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.]</div>
</div>
</blockquote></div><div><br></div>Good point, thanks!<div><br><div><span class="Apple-tab-span" style="white-space:pre">      </span>- Doug</div></div></body></html>