[PATCH] [libcxx] SFINAE-friendly common_type

Eric Fiselier eric at efcs.ca
Fri May 1 12:16:19 PDT 2015


In http://reviews.llvm.org/D6964#164887, @K-ballo wrote:

> I am willing but time is lacking, and I'm already on my way to Lenexa. If you know how to workaround CWG1432 and want to move this patch forward quickly then don't let me hold it.


Right! I forgot that the US is quite a trek for you. I'll see you in Lenexa. I'm not worried about moving this quickly I just feel bad for leaving this for so long. Sorry : (


================
Comment at: include/type_traits:1501-1502
@@ -1491,1 +1500,4 @@
 
+template <class _Tp, class _Up, class ..._Vp>
+struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up, _Vp...>
+    : __common_type_impl<__common_types<_Tp, _Up, _Vp...> > {};
----------------
K-ballo wrote:
> EricWF wrote:
> > K-ballo wrote:
> > > EricWF wrote:
> > > > Isn't there a core language defect about the following specializations being ambiguous? Something along the lines of this? 
> > > > 
> > > > ```
> > > > template <class ...> struct Foo;
> > > > 
> > > > template <class T> 
> > > > struct Foo<T> {}; // Specialization 1
> > > > 
> > > > template <class T, class ... Args>
> > > > struct Foo<T, Args...> {}; // Specialization 2
> > > > 
> > > > using MyFoo = Foo<int>; // The defect is that both 1 and 2 match.
> > > > 
> > > > ```
> > > > 
> > > > As far as I know it is accepted by all compilers but I just wanted to bring this up.
> > > > 
> > > I'm not sure, will investigate.
> > I think I found the bug that tracks this: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1432 . Could we work around it for now?
> I'm not sure I understand how to workaround this issue. Would that just take a third non-variadic argument, say `<_Tp, _Up, _Vp, Wp...>`?
Yeah I think that is how you work around it. However I just noticed that our current `common_type` has this problem and it hasn't broken yet.

http://reviews.llvm.org/D6964

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






More information about the cfe-commits mailing list