From 60963a5d21b0560f79e7a88cf1af9b428c065dd3 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Wed, 12 Sep 2007 16:44:16 +0000 Subject: [PATCH] Fixed is_base_of/is_base_and_derived so that you get a compiler error if you try and use them with an incomplete class type. [SVN r39219] --- include/boost/type_traits/is_base_and_derived.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/boost/type_traits/is_base_and_derived.hpp b/include/boost/type_traits/is_base_and_derived.hpp index a3157f7..23b9727 100644 --- a/include/boost/type_traits/is_base_and_derived.hpp +++ b/include/boost/type_traits/is_base_and_derived.hpp @@ -15,6 +15,7 @@ #include #include #include +#include // should be the last #include #include @@ -128,6 +129,13 @@ struct bd_helper template struct is_base_and_derived_impl2 { + // + // May silently do the wrong thing with incomplete types + // unless we trap them here: + // + BOOST_STATIC_ASSERT(sizeof(B)); + BOOST_STATIC_ASSERT(sizeof(D)); + struct Host { #if !BOOST_WORKAROUND(BOOST_MSVC, == 1310)