Quuxplusone added inline comments.

================
Comment at: clang/test/CXX/drs/dr7xx.cpp:225
 template <typename... T>
 void f(int i = 0, T ...args) {}
 void ff() { f(); }
----------------
rjmccall wrote:
> Quuxplusone wrote:
> > Is this even supposed to compile? The only valid specializations of `f` 
> > require `T...` to be an empty pack, which violates 
> > [temp.res/8.3](https://timsong-cpp.github.io/cppwp/temp.res#8.3).
> > 
> > The comment mentions 
> > [DR777](http://cwg-issue-browser.herokuapp.com/cwg777), but DR777 doesn't 
> > explain the circumstances under which its wording change matters. It 
> > //seems// only to apply to templates that are already ill-formed by 
> > temp.res/8.3.
> Yeah, Richard made this point in 
> [[http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2233|DR2233]], 
> and the wording was weakened to allow it, in a way that essentially makes the 
> earlier default arguments dead.
Huh. Ick. Indeed the other vendors seem to be implementing DR777/DR2233, so I 
guess Clang ought to catch up even if it's a silly direction to go in. :( I do 
see a small bit of implementation divergence in https://godbolt.org/z/ZMCvAX —
```
template<class... Ts>
int f(int i=1, Ts... ts) { return (i + ... + ts); }

template<>
int f<int>(int i, int j) { return 42; }
```
GCC rejects as ill-formed. MSVC makes the specialization callable with 2 
arguments only. EDG (ICC) makes the specialization callable with 0 or 2 
arguments (and does [crazy things](https://godbolt.org/z/QTrVeh) when you call 
it with 0 arguments).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79800/new/

https://reviews.llvm.org/D79800



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to