fix fug SuperSubclass and incomplete classes, 630897

git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@184 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
syntheticpp 2005-07-27 19:59:05 +00:00
parent ecd3aa136e
commit a3ad4d38e2

View file

@ -171,11 +171,11 @@ namespace Loki
template <class T, class U> template <class T, class U>
struct SuperSubclass struct SuperSubclass
{ {
enum { value = (::Loki::Conversion<const volatile U*, const volatile T*>::exists && enum { value = (::Loki::Conversion<const volatile U*, const volatile T*>::exists &&
!::Loki::Conversion<const volatile T*, const volatile void*>::sameType) }; !::Loki::Conversion<const volatile T*, const volatile void*>::sameType) };
// Dummy data member to make sure that both classes are fully defined. // Dummy data member to make sure that both classes are fully defined.
char dummy[sizeof (T) + sizeof (U)]; char dummy[sizeof (T) + sizeof (U)];
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -189,12 +189,12 @@ struct SuperSubclass
template<class T,class U> template<class T,class U>
struct SuperSubclassStrict struct SuperSubclassStrict
{ {
enum { value = (::Loki::Conversion<const volatile U*, const volatile T*>::exists && enum { value = (::Loki::Conversion<const volatile U*, const volatile T*>::exists &&
!::Loki::Conversion<const volatile T*, const volatile void*>::sameType && !::Loki::Conversion<const volatile T*, const volatile void*>::sameType &&
!::Loki::Conversion<const volatile T*, const volatile U*>::sameType) }; !::Loki::Conversion<const volatile T*, const volatile U*>::sameType) };
// Dummy data member to make sure that both classes are fully defined. // Dummy data member to make sure that both classes are fully defined.
char dummy[sizeof (T) + sizeof (U)]; char dummy[sizeof (T) + sizeof (U)];
}; };
} // namespace Loki } // namespace Loki
@ -238,6 +238,8 @@ struct SuperSubclassStrict
// macros are deprecated. // macros are deprecated.
// Added extra parenthesis in sizeof in Conversion, to disambiguate function // Added extra parenthesis in sizeof in Conversion, to disambiguate function
// call from function declaration. T.S. // call from function declaration. T.S.
// July 27, 2005 : compiler error on using Sub/Super with incomplete types
// (credit due to Mark Stevans)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#endif // TYPEMANIP_INC_ #endif // TYPEMANIP_INC_