[libcxx] r215984 - Fix is_member_function_pointer does not account for ellipsis. PR20345. Patch from Agustin Berge.

Eric Fiselier eric at efcs.ca
Tue Aug 19 09:31:47 PDT 2014


Author: ericwf
Date: Tue Aug 19 11:31:47 2014
New Revision: 215984

URL: http://llvm.org/viewvc/llvm-project?rev=215984&view=rev
Log:
Fix is_member_function_pointer does not account for ellipsis. PR20345. Patch from Agustin Berge.

I reviewed the patch and added the test cases.

Modified:
    libcxx/trunk/include/type_traits
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp

Modified: libcxx/trunk/include/type_traits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=215984&r1=215983&r2=215984&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Tue Aug 19 11:31:47 2014
@@ -1698,6 +1698,14 @@ struct __member_pointer_traits_imp<_Rp (
 };
 
 template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false>
+{
+    typedef _Class _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false>
 {
     typedef _Class const _ClassType;
@@ -1706,6 +1714,14 @@ struct __member_pointer_traits_imp<_Rp (
 };
 
 template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const, true, false>
+{
+    typedef _Class const _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false>
 {
     typedef _Class volatile _ClassType;
@@ -1714,6 +1730,14 @@ struct __member_pointer_traits_imp<_Rp (
 };
 
 template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile, true, false>
+{
+    typedef _Class volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false>
 {
     typedef _Class const volatile _ClassType;
@@ -1721,6 +1745,14 @@ struct __member_pointer_traits_imp<_Rp (
     typedef _Rp (_FnType) (_Param...);
 };
 
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile, true, false>
+{
+    typedef _Class const volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
 #if __has_feature(cxx_reference_qualified_functions)
 
 template <class _Rp, class _Class, class ..._Param>
@@ -1732,6 +1764,14 @@ struct __member_pointer_traits_imp<_Rp (
 };
 
 template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &, true, false>
+{
+    typedef _Class& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false>
 {
     typedef _Class const& _ClassType;
@@ -1740,6 +1780,14 @@ struct __member_pointer_traits_imp<_Rp (
 };
 
 template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&, true, false>
+{
+    typedef _Class const& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false>
 {
     typedef _Class volatile& _ClassType;
@@ -1748,6 +1796,14 @@ struct __member_pointer_traits_imp<_Rp (
 };
 
 template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&, true, false>
+{
+    typedef _Class volatile& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false>
 {
     typedef _Class const volatile& _ClassType;
@@ -1756,6 +1812,14 @@ struct __member_pointer_traits_imp<_Rp (
 };
 
 template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&, true, false>
+{
+    typedef _Class const volatile& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false>
 {
     typedef _Class&& _ClassType;
@@ -1764,6 +1828,14 @@ struct __member_pointer_traits_imp<_Rp (
 };
 
 template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &&, true, false>
+{
+    typedef _Class&& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false>
 {
     typedef _Class const&& _ClassType;
@@ -1772,6 +1844,14 @@ struct __member_pointer_traits_imp<_Rp (
 };
 
 template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&&, true, false>
+{
+    typedef _Class const&& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false>
 {
     typedef _Class volatile&& _ClassType;
@@ -1780,6 +1860,14 @@ struct __member_pointer_traits_imp<_Rp (
 };
 
 template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&&, true, false>
+{
+    typedef _Class volatile&& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false>
 {
     typedef _Class const volatile&& _ClassType;
@@ -1787,6 +1875,14 @@ struct __member_pointer_traits_imp<_Rp (
     typedef _Rp (_FnType) (_Param...);
 };
 
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&&, true, false>
+{
+    typedef _Class const volatile&& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
 #endif  // __has_feature(cxx_reference_qualified_functions)
 
 #else  // _LIBCPP_HAS_NO_VARIADICS
@@ -1799,6 +1895,14 @@ struct __member_pointer_traits_imp<_Rp (
     typedef _Rp (_FnType) ();
 };
 
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(...), true, false>
+{
+    typedef _Class _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (...);
+};
+
 template <class _Rp, class _Class, class _P0>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false>
 {
@@ -1807,6 +1911,14 @@ struct __member_pointer_traits_imp<_Rp (
     typedef _Rp (_FnType) (_P0);
 };
 
+template <class _Rp, class _Class, class _P0>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...), true, false>
+{
+    typedef _Class _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, ...);
+};
+
 template <class _Rp, class _Class, class _P0, class _P1>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false>
 {
@@ -1815,6 +1927,14 @@ struct __member_pointer_traits_imp<_Rp (
     typedef _Rp (_FnType) (_P0, _P1);
 };
 
+template <class _Rp, class _Class, class _P0, class _P1>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...), true, false>
+{
+    typedef _Class _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, ...);
+};
+
 template <class _Rp, class _Class, class _P0, class _P1, class _P2>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false>
 {
@@ -1823,6 +1943,14 @@ struct __member_pointer_traits_imp<_Rp (
     typedef _Rp (_FnType) (_P0, _P1, _P2);
 };
 
+template <class _Rp, class _Class, class _P0, class _P1, class _P2>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...), true, false>
+{
+    typedef _Class _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
+};
+
 template <class _Rp, class _Class>
 struct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false>
 {
@@ -1831,6 +1959,14 @@ struct __member_pointer_traits_imp<_Rp (
     typedef _Rp (_FnType) ();
 };
 
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(...) const, true, false>
+{
+    typedef _Class const _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (...);
+};
+
 template <class _Rp, class _Class, class _P0>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false>
 {
@@ -1839,6 +1975,14 @@ struct __member_pointer_traits_imp<_Rp (
     typedef _Rp (_FnType) (_P0);
 };
 
+template <class _Rp, class _Class, class _P0>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) const, true, false>
+{
+    typedef _Class const _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, ...);
+};
+
 template <class _Rp, class _Class, class _P0, class _P1>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false>
 {
@@ -1847,6 +1991,14 @@ struct __member_pointer_traits_imp<_Rp (
     typedef _Rp (_FnType) (_P0, _P1);
 };
 
+template <class _Rp, class _Class, class _P0, class _P1>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) const, true, false>
+{
+    typedef _Class const _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, ...);
+};
+
 template <class _Rp, class _Class, class _P0, class _P1, class _P2>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, false>
 {
@@ -1855,6 +2007,14 @@ struct __member_pointer_traits_imp<_Rp (
     typedef _Rp (_FnType) (_P0, _P1, _P2);
 };
 
+template <class _Rp, class _Class, class _P0, class _P1, class _P2>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) const, true, false>
+{
+    typedef _Class const _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
+};
+
 template <class _Rp, class _Class>
 struct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false>
 {
@@ -1863,6 +2023,14 @@ struct __member_pointer_traits_imp<_Rp (
     typedef _Rp (_FnType) ();
 };
 
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(...) volatile, true, false>
+{
+    typedef _Class volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (...);
+};
+
 template <class _Rp, class _Class, class _P0>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false>
 {
@@ -1871,6 +2039,14 @@ struct __member_pointer_traits_imp<_Rp (
     typedef _Rp (_FnType) (_P0);
 };
 
+template <class _Rp, class _Class, class _P0>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) volatile, true, false>
+{
+    typedef _Class volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, ...);
+};
+
 template <class _Rp, class _Class, class _P0, class _P1>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, false>
 {
@@ -1879,6 +2055,14 @@ struct __member_pointer_traits_imp<_Rp (
     typedef _Rp (_FnType) (_P0, _P1);
 };
 
+template <class _Rp, class _Class, class _P0, class _P1>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) volatile, true, false>
+{
+    typedef _Class volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, ...);
+};
+
 template <class _Rp, class _Class, class _P0, class _P1, class _P2>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true, false>
 {
@@ -1887,6 +2071,14 @@ struct __member_pointer_traits_imp<_Rp (
     typedef _Rp (_FnType) (_P0, _P1, _P2);
 };
 
+template <class _Rp, class _Class, class _P0, class _P1, class _P2>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) volatile, true, false>
+{
+    typedef _Class volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
+};
+
 template <class _Rp, class _Class>
 struct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false>
 {
@@ -1895,6 +2087,14 @@ struct __member_pointer_traits_imp<_Rp (
     typedef _Rp (_FnType) ();
 };
 
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(...) const volatile, true, false>
+{
+    typedef _Class const volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (...);
+};
+
 template <class _Rp, class _Class, class _P0>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, false>
 {
@@ -1903,6 +2103,14 @@ struct __member_pointer_traits_imp<_Rp (
     typedef _Rp (_FnType) (_P0);
 };
 
+template <class _Rp, class _Class, class _P0>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) const volatile, true, false>
+{
+    typedef _Class const volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, ...);
+};
+
 template <class _Rp, class _Class, class _P0, class _P1>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, true, false>
 {
@@ -1911,6 +2119,14 @@ struct __member_pointer_traits_imp<_Rp (
     typedef _Rp (_FnType) (_P0, _P1);
 };
 
+template <class _Rp, class _Class, class _P0, class _P1>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) const volatile, true, false>
+{
+    typedef _Class const volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, ...);
+};
+
 template <class _Rp, class _Class, class _P0, class _P1, class _P2>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile, true, false>
 {
@@ -1919,6 +2135,14 @@ struct __member_pointer_traits_imp<_Rp (
     typedef _Rp (_FnType) (_P0, _P1, _P2);
 };
 
+template <class _Rp, class _Class, class _P0, class _P1, class _P2>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) const volatile, true, false>
+{
+    typedef _Class const volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
+};
+
 #endif  // _LIBCPP_HAS_NO_VARIADICS
 
 template <class _Rp, class _Class>

Modified: libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp?rev=215984&r1=215983&r2=215984&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp Tue Aug 19 11:31:47 2014
@@ -61,6 +61,18 @@ int main()
     test_member_function_pointer<void (Class::*)(int) volatile>();
     test_member_function_pointer<void (Class::*)(int, char) volatile>();
 
+    test_member_function_pointer<void (Class::*)(...)>();
+    test_member_function_pointer<void (Class::*)(int, ...)>();
+    test_member_function_pointer<void (Class::*)(int, char, ...)>();
+
+    test_member_function_pointer<void (Class::*)(...) const>();
+    test_member_function_pointer<void (Class::*)(int, ...) const>();
+    test_member_function_pointer<void (Class::*)(int, char, ...) const>();
+
+    test_member_function_pointer<void (Class::*)(...) volatile>();
+    test_member_function_pointer<void (Class::*)(int, ...) volatile>();
+    test_member_function_pointer<void (Class::*)(int, char, ...) volatile>();
+
 #if __cplusplus >= 201103L
 // reference qualifiers on functions are a C++11 extension
     test_member_function_pointer<void (Class::*)() &&>();
@@ -74,5 +86,17 @@ int main()
     test_member_function_pointer<void (Class::*)() volatile &&>();
     test_member_function_pointer<void (Class::*)(int) volatile &&>();
     test_member_function_pointer<void (Class::*)(int, char) volatile &&>();
+
+    test_member_function_pointer<void (Class::*)(...) &&>();
+    test_member_function_pointer<void (Class::*)(int,...) &&>();
+    test_member_function_pointer<void (Class::*)(int, char,...) &&>();
+
+    test_member_function_pointer<void (Class::*)(...) &>();
+    test_member_function_pointer<void (Class::*)(int,...) &>();
+    test_member_function_pointer<void (Class::*)(int, char,...) &>();
+
+    test_member_function_pointer<void (Class::*)(...) volatile &&>();
+    test_member_function_pointer<void (Class::*)(int,...) volatile &&>();
+    test_member_function_pointer<void (Class::*)(int, char,...) volatile &&>();
 #endif
 }





More information about the cfe-commits mailing list