[PATCH] Consolidate and unify initializer list deduction

Hubert Tong hubert.reinterpretcast at gmail.com
Wed Jun 24 14:25:11 PDT 2015


The additional bug appears to affect more than just the part being changed here. I think it would make sense to leave that change for a separate commit (and get the clean up done there).


================
Comment at: lib/Sema/SemaTemplateDeduction.cpp:3432-3433
@@ -3411,3 +3431,4 @@
+                                       Info, Deduced, TDF, Result)) {
           ++ArgIdx;
           break;
         }
----------------
rsmith wrote:
> Is this really right? It seems to cause an accepts-invalid on this:
> 
>     #include <initializer_list>
>     #include <tuple>
>     template<typename ...T> void f(std::tuple<T...> a, T ...b);
>     void g() { f(std::make_tuple(1, 2), {}, 3.0); }
> 
> Should this instead be ignoring this P/A pair and carrying on to the next, as we do if deduction succeeds? (This is a pre-existing bug, but it's the only barrier to the cleanup I suggested above.)
This seems to be a larger issue having to do with undeduced contexts and trailing parameter packs.

```
#include <initializer_list>
#include <tuple>
void f();
void f(bool);

typedef void (*fptype)();
struct Func { operator fptype(); } func;

template<typename ...T> void f(std::tuple<T...> a, T ...b);
void g() { f(std::make_tuple(fptype(), fptype()), f, func); } // Clang and GCC accept
void g1() { f(std::make_tuple(fptype(), fptype()), func, f); } // GCC accepts, Clang rejects
```

http://reviews.llvm.org/D10681

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list