Author: vitek
Date: Wed Jul  9 17:48:07 2008
New Revision: 675393

URL: http://svn.apache.org/viewvc?rev=675393&view=rev
Log:
2008-07-09  Travis Vitek  <[EMAIL PROTECTED]>

        STDCXX-916
        * include/rw/_config-msvc.h: Fix definition of _RWSTD_TT_ALIGNED_POD
        broken in r675050.
        * include/rw/_meta_rel.h: Update comments for __rw_is_base_of_impl<>,
        simplify implementation a tiny bit. Move __rw_is_convertible_impl<>
        down to avoid defining it unless necessary. Remove stray tabs.
        [_MSC_VER]: Add fallback for __rw_is_convertible to detect void-void
        conversions.
        * include/rw/_meta_cat.h: Remove stray tab.
        * include/rw/_meta_comp.h: Remove stray tabs.
        * include/rw/_meta_prop.h: Fix typos in template __rw_is_empty_impl<>.
        * tests/utilities/20.meta.rel.cpp (test_is_base_of): Add additional
        test cases.
        (test_is_convertible): Ditto.

Modified:
    stdcxx/branches/4.3.x/include/rw/_config-msvc.h
    stdcxx/branches/4.3.x/include/rw/_meta_cat.h
    stdcxx/branches/4.3.x/include/rw/_meta_comp.h
    stdcxx/branches/4.3.x/include/rw/_meta_prop.h
    stdcxx/branches/4.3.x/include/rw/_meta_rel.h
    stdcxx/branches/4.3.x/tests/utilities/20.meta.rel.cpp

Modified: stdcxx/branches/4.3.x/include/rw/_config-msvc.h
URL: 
http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/rw/_config-msvc.h?rev=675393&r1=675392&r2=675393&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_config-msvc.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_config-msvc.h Wed Jul  9 17:48:07 2008
@@ -112,7 +112,7 @@
 
 #  define _RWSTD_TT_ALIGN_OF(T)            __alignof(T)
 #  define _RWSTD_TT_ALIGNED_POD(N)         \
-      struct {__declspec(align(Align)) unsigned char _C_align; }
+      struct {__declspec(align(N)) unsigned char _C_align; }
 
 #  define _RWSTD_TT_MAX_ALIGNMENT          8192
 #endif // _MSC_FULL_VER >= 140050215

Modified: stdcxx/branches/4.3.x/include/rw/_meta_cat.h
URL: 
http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/rw/_meta_cat.h?rev=675393&r1=675392&r2=675393&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_meta_cat.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_meta_cat.h Wed Jul  9 17:48:07 2008
@@ -312,7 +312,7 @@
 struct __rw_is_function_impl<_TypeT, false>
 {
     typedef _TypeT& _TypeT_Ref;
-       typedef _TypeT* _TypeT_Ptr;
+    typedef _TypeT* _TypeT_Ptr;
 
     struct _C_no  { };
     struct _C_yes { _C_no __pad [2]; };

Modified: stdcxx/branches/4.3.x/include/rw/_meta_comp.h
URL: 
http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/rw/_meta_comp.h?rev=675393&r1=675392&r2=675393&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_meta_comp.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_meta_comp.h Wed Jul  9 17:48:07 2008
@@ -38,7 +38,7 @@
 template <class _TypeT>
 struct __rw_is_reference
     : __rw_integral_constant<bool,
-                __rw_is_lvalue_reference<_TypeT>::value
+             __rw_is_lvalue_reference<_TypeT>::value
           || __rw_is_rvalue_reference<_TypeT>::value>
 {
 };
@@ -48,7 +48,7 @@
 template <class _TypeT>
 struct __rw_is_arithmetic
     : __rw_integral_constant<bool,
-                __rw_is_integral<_TypeT>::value
+             __rw_is_integral<_TypeT>::value
           || __rw_is_floating_point<_TypeT>::value>
 {
 };
@@ -79,7 +79,7 @@
 template <class _TypeT>
 struct __rw_is_member_pointer
     : __rw_integral_constant<bool,
-                __rw_is_member_function_pointer<_TypeT>::value
+             __rw_is_member_function_pointer<_TypeT>::value
           || __rw_is_member_object_pointer<_TypeT>::value>
 {
 };

Modified: stdcxx/branches/4.3.x/include/rw/_meta_prop.h
URL: 
http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/rw/_meta_prop.h?rev=675393&r1=675392&r2=675393&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_meta_prop.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_meta_prop.h Wed Jul  9 17:48:07 2008
@@ -157,10 +157,10 @@
 #elif defined (_MSC_VER)
 
 template <class _TypeT>
-struct __rw_is_empty_impl<_TypeT>
+struct __rw_is_empty_impl
 {
-    enum { _C_value = __rw_is_class<_TypeT>::value
-                         && _RWSTD_TT_IS_EMPTY (_TypeT) };
+    enum { _C_value =    __rw_is_class<_TypeT>::value
+                      && _RWSTD_TT_IS_EMPTY (_TypeT) };
 };
 
 

Modified: stdcxx/branches/4.3.x/include/rw/_meta_rel.h
URL: 
http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/rw/_meta_rel.h?rev=675393&r1=675392&r2=675393&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_meta_rel.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_meta_rel.h Wed Jul  9 17:48:07 2008
@@ -60,36 +60,9 @@
 #define _RWSTD_IS_SAME(T,U) _RW::__rw_is_same<T,U>::value
 
 
-
-template <class _From, class _To>
-struct __rw_is_convertible_impl
-{
-    struct _C_no  { };
-    struct _C_yes { _C_no __pad [2]; };
-
-    struct _Dummy
-    {
-        template <class _Anything>
-        _Dummy (_Anything);
-    };
-
-    template <class _TypeT>
-    static _C_no _C_is (_Dummy, _TypeT);
-    static _C_yes _C_is (_To, int);
-
-    static _From _C_make ();
-
-    enum { _C_value = sizeof (_C_yes) == sizeof (_C_is (_C_make (), 0)) };
-};
-
-
-
 #ifndef _RWSTD_TT_IS_BASE_OF
 
 //
-// This fallback tests if a pointer to _Base is convertible to a
-// pointer of _Derived after both types have been cv-stripped.
-//
 // This little gem was taken from a comp.lang.c++.moderated post
 // by Rani Sharoni [see http://tinyurl.com/6pdv3k]
 //
@@ -104,6 +77,9 @@
     struct _C_no  { };
     struct _C_yes { _C_no __pad [2]; };
 
+    // the template is used so that the compiler will prefer the
+    // non-template _C_is, in case that the conversion would be
+    // ambiguous (as it is in the case where the types are unrelated).
     template <class _TypeT>
     static _C_yes _C_is (_NoCV_Derived&, _TypeT);
     static _C_no _C_is  (_NoCV_Base&   , int);
@@ -114,11 +90,9 @@
         operator _NoCV_Derived& ();
     };
 
-    static _C_nest _C_make ();
-
     enum { _C_value = 
            __rw_is_same<_NoCV_Base, _NoCV_Derived>::value
-        || sizeof (_C_yes) == sizeof (_C_is (_C_make (), 0)) };
+        || sizeof (_C_yes) == sizeof (_C_is (_C_nest (), 0)) };
 };
 
 //
@@ -148,6 +122,28 @@
 
 
 #ifndef _RWSTD_TT_IS_CONVERTIBLE
+
+template <class _From, class _To>
+struct __rw_is_convertible_impl
+{
+    struct _C_no  { };
+    struct _C_yes { _C_no __pad [2]; };
+
+    struct _Dummy
+    {
+        template <class _Anything>
+        _Dummy (_Anything);
+    };
+
+    template <class _TypeT>
+    static _C_no _C_is (_Dummy, _TypeT);
+    static _C_yes _C_is (_To, int);
+
+    static _From _C_make ();
+
+    enum { _C_value = sizeof (_C_yes) == sizeof (_C_is (_C_make (), 0)) };
+};
+
 template <class _TypeT, class _TypeU,
           bool = __rw_is_array<_TypeT>::value,
           bool = __rw_is_function<_TypeT>::value>
@@ -166,7 +162,7 @@
     typedef typename __rw_add_pointer<_TypeV>::type _TypeT_Ptr;
 
     enum { _C_value =
-           __rw_is_convertible_impl<_TypeT_Ptr, _TypeU>::_C_value };
+        __rw_is_convertible_impl<_TypeT_Ptr, _TypeU>::_C_value };
 };
 
 template <class _TypeT, class _TypeU>
@@ -177,7 +173,7 @@
     typedef typename __rw_add_pointer<_TypeT>::type _TypeT_Ptr;
 
     enum { _C_value =
-              __rw_is_convertible_impl<_TypeT_Ref, _TypeU>::_C_value
+           __rw_is_convertible_impl<_TypeT_Ref, _TypeU>::_C_value
         || __rw_is_convertible_impl<_TypeT_Ptr, _TypeU>::_C_value };
 };
         
@@ -222,6 +218,21 @@
 
 #  define _RWSTD_TT_IS_CONVERTIBLE(T,U) \
      _RW::__rw_is_convertible_1<T,U>::_C_value
+
+#elif defined (_MSC_VER)
+
+template <class _TypeT, class _TypeU>
+struct __rw_is_convertible_1
+{
+    enum { _C_value =
+         __rw_is_void<_TypeT>::value && __rw_is_void<_TypeU>::value
+      || _RWSTD_TT_IS_CONVERTIBLE(_TypeT, _TypeU) };
+};
+
+#  undef _RWSTD_TT_IS_CONVERTIBLE
+#  define _RWSTD_TT_IS_CONVERTIBLE(T,U) \
+     _RW::__rw_is_convertible_1<T,U>::_C_value
+
 #endif // _RWSTD_TT_IS_CONVERTIBLE
 
 template <class _TypeT, class _TypeU>

Modified: stdcxx/branches/4.3.x/tests/utilities/20.meta.rel.cpp
URL: 
http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/utilities/20.meta.rel.cpp?rev=675393&r1=675392&r2=675393&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.meta.rel.cpp (original)
+++ stdcxx/branches/4.3.x/tests/utilities/20.meta.rel.cpp Wed Jul  9 17:48:07 
2008
@@ -225,6 +225,12 @@
 
     TEST (std::is_base_of, int[], int*, false);
     TEST (std::is_base_of, int*, int[], false);
+
+    TEST (std::is_base_of, struct_A, class_B, false);
+    TEST (std::is_base_of, class_B, struct_A, false);
+
+    TEST (std::is_base_of, derived_<struct_A>, struct_A, false);
+    TEST (std::is_base_of, derived_<class_B>, class_B, false);
 }
 
 static void test_is_convertible ()
@@ -334,9 +340,27 @@
     TEST (std::is_convertible, int (), int (&)(char), false);
 
     TEST (std::is_convertible, int*, void*, true);
-    TEST (std::is_convertible, int (*)(), void*, false);
+    TEST (std::is_convertible, int (*)(), void*, true);
 
-    //TEST (std::is_convertible, int (*)(derived_<struct_A>::*), int 
(*)(struct_A::*), true);
+    TEST (std::is_convertible,
+          int (*)(derived_<struct_A>*),
+          int (*)(struct_A*), false);
+
+    TEST (std::is_convertible,
+          int (*)(struct_A*),
+          int (*)(derived_<struct_A>*), false);
+
+    // pointer to derived member convertible to
+    // pointer to base member
+    TEST (std::is_convertible,
+          int derived_<struct_A>::*,
+          int struct_A::*, false);
+
+    // pointer to base member convertible to
+    // pointer to derived member
+    TEST (std::is_convertible,
+          int struct_A::*,
+          int derived_<struct_A>::*, true);
 
     TEST (std::is_convertible, int, double, true);
     TEST (std::is_convertible, const int, double, true);


Reply via email to