$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: peder.holt_at_[hidden]
Date: 2007-10-08 13:46:23
Author: burbelgruff
Date: 2007-10-08 13:46:23 EDT (Mon, 08 Oct 2007)
New Revision: 39796
URL: http://svn.boost.org/trac/boost/changeset/39796
Log:
[typeof] testing for typeof hacks on all compilers
Added:
   trunk/libs/typeof/test/experimental_1.cpp   (contents, props changed)
   trunk/libs/typeof/test/experimental_2.cpp   (contents, props changed)
   trunk/libs/typeof/test/experimental_3.cpp   (contents, props changed)
   trunk/libs/typeof/test/experimental_4.cpp   (contents, props changed)
Added: trunk/libs/typeof/test/experimental_1.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/typeof/test/experimental_1.cpp	2007-10-08 13:46:23 EDT (Mon, 08 Oct 2007)
@@ -0,0 +1,26 @@
+
+template<typename ID>
+struct msvc_extract_type
+{
+    template<bool>
+    struct id2type_impl;
+
+    typedef id2type_impl<true> id2type;
+};
+
+template<typename T, typename ID>
+struct msvc_register_type : msvc_extract_type<ID>
+{
+    template<>
+    struct id2type_impl<true>  //VC7.0 specific bugfeature
+    {
+        typedef T type;
+    };
+};
+
+int main() {
+    sizeof(msvc_register_type<double,int>);
+    typedef msvc_extract_type<int>::id2type::type deduced_type;
+    deduced_type f=5.0;
+    return 0;
+}
\ No newline at end of file
Added: trunk/libs/typeof/test/experimental_2.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/typeof/test/experimental_2.cpp	2007-10-08 13:46:23 EDT (Mon, 08 Oct 2007)
@@ -0,0 +1,39 @@
+
+struct msvc_extract_type_default_param {};
+
+template<typename ID, typename T = msvc_extract_type_default_param>
+struct msvc_extract_type;
+
+template<typename ID>
+struct msvc_extract_type<ID, msvc_extract_type_default_param> {
+    template<bool>
+    struct id2type_impl;
+
+    typedef id2type_impl<true> id2type;
+};
+
+template<typename ID, typename T>
+struct msvc_extract_type : msvc_extract_type<ID,msvc_extract_type_default_param>
+{
+    template<>
+    struct id2type_impl<true>  //VC8.0 specific bugfeature
+    {
+        typedef T type;
+    };
+    template<bool>
+    struct id2type_impl;
+
+    typedef id2type_impl<true> id2type;
+};
+
+template<typename T, typename ID>
+struct msvc_register_type : msvc_extract_type<ID, T>
+{
+};
+
+int main() {
+    sizeof(msvc_register_type<double,int>);
+    typedef msvc_extract_type<int>::id2type::type deduced_type;
+    deduced_type f=5.0;
+    return 0;
+}
\ No newline at end of file
Added: trunk/libs/typeof/test/experimental_3.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/typeof/test/experimental_3.cpp	2007-10-08 13:46:23 EDT (Mon, 08 Oct 2007)
@@ -0,0 +1,23 @@
+
+template<typename ID>
+struct msvc_extract_type
+{
+    struct id2type;
+};
+
+template<typename T, typename ID>
+struct msvc_register_type : msvc_extract_type<ID>
+{
+    typedef msvc_extract_type<ID> base_type;
+    struct base_type::id2type // This uses nice VC6.5 and VC7.1 bugfeature
+    {
+        typedef T type;
+    };
+};
+
+int main() {
+    sizeof(msvc_register_type<double,int>);
+    typedef msvc_extract_type<int>::id2type::type deduced_type;
+    deduced_type f=5.0;
+    return 0;
+}
\ No newline at end of file
Added: trunk/libs/typeof/test/experimental_4.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/typeof/test/experimental_4.cpp	2007-10-08 13:46:23 EDT (Mon, 08 Oct 2007)
@@ -0,0 +1,9 @@
+#include <typeinfo>
+
+template<const std::type_info& info>
+struct msvc_register_type {
+};
+
+int main() {
+    msvc_register_type<typeid(double)>;
+}
\ No newline at end of file