Move Console from Scheduler into Utils
[senf.git] / Packets / Packet.test.cc
index 8c28f73..e61d67a 100644 (file)
@@ -28,6 +28,7 @@
 
 // Custom includes
 #include <sstream>
+#include <boost/static_assert.hpp>
 #include "Packets.hh"
 
 #include "../Utils/auto_unit_test.hh"
@@ -126,6 +127,11 @@ namespace {
     struct ComplexEmptyAnnotation : senf::ComplexAnnotation
     {};
 
+    struct InvalidAnnotation
+    {
+        std::string value;
+    };
+
 }
 
 BOOST_AUTO_UNIT_TEST(packet)
@@ -273,6 +279,24 @@ BOOST_AUTO_UNIT_TEST(packetAnnotation)
     BOOST_CHECK( ! senf::detail::AnnotationIndexer<ComplexEmptyAnnotation>::Small );
 }
 
+#ifdef COMPILE_CHECK
+
+COMPILE_FAIL(invalidAnnotation)
+{
+#   ifdef BOOST_HAS_TYPE_TRAITS_INTRINSICS
+
+    senf::Packet packet (FooPacket::create());
+    (void) packet.annotation<InvalidAnnotation>();
+
+#   else
+
+    invalid_annotation_check_disabled();
+
+#   endif
+}
+
+#endif
+
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_