diff --git a/include/boost/container_hash/is_described_class.hpp b/include/boost/container_hash/is_described_class.hpp index 81f16d5..cd2e1db 100644 --- a/include/boost/container_hash/is_described_class.hpp +++ b/include/boost/container_hash/is_described_class.hpp @@ -6,6 +6,7 @@ #define BOOST_HASH_IS_DESCRIBED_CLASS_HPP_INCLUDED #include +#include #include #include @@ -17,7 +18,9 @@ namespace container_hash #if defined(BOOST_DESCRIBE_CXX11) template struct is_described_class: boost::integral_constant::value && describe::has_describe_members::value> + describe::has_describe_bases::value && + describe::has_describe_members::value && + !boost::is_union::value> { }; diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 647f6dc..2400270 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -107,3 +107,5 @@ run is_described_class_test.cpp : : : extra ; run is_described_class_test2.cpp : : : extra ; +run is_described_class_test3.cpp + : : : extra ; diff --git a/test/is_described_class_test3.cpp b/test/is_described_class_test3.cpp new file mode 100644 index 0000000..e75da72 --- /dev/null +++ b/test/is_described_class_test3.cpp @@ -0,0 +1,31 @@ +// Copyright 2022 Peter Dimov. +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include +#include +#include + +union Y1 +{ +}; + +BOOST_DESCRIBE_STRUCT( Y1, (), () ) + +union Y2 +{ + int m1; + float m2; +}; + +BOOST_DESCRIBE_STRUCT( Y2, (), (m1, m2) ) + +int main() +{ + using boost::container_hash::is_described_class; + + BOOST_TEST_TRAIT_FALSE((is_described_class)); + BOOST_TEST_TRAIT_FALSE((is_described_class)); + + return boost::report_errors(); +}