From 68545773d52a32d6c78b2851769c5bba93264ee1 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Thu, 12 Feb 2004 11:29:47 +0000 Subject: [PATCH] Changed tests to guarantee portability [SVN r22245] --- static_assert_test_fail_1.cpp | 4 +++- static_assert_test_fail_2.cpp | 4 +++- static_assert_test_fail_3.cpp | 5 +++-- static_assert_test_fail_4.cpp | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/static_assert_test_fail_1.cpp b/static_assert_test_fail_1.cpp index 4f3d93d..d8e0107 100644 --- a/static_assert_test_fail_1.cpp +++ b/static_assert_test_fail_1.cpp @@ -10,9 +10,11 @@ // // all these tests should fail: // +typedef char a1[2]; +typedef char a2[3]; // Namespace scope -BOOST_STATIC_ASSERT(sizeof(int) == sizeof(char)); // will not compile +BOOST_STATIC_ASSERT(sizeof(a1) == sizeof(a2)); // will not compile diff --git a/static_assert_test_fail_2.cpp b/static_assert_test_fail_2.cpp index 406d598..c75de49 100644 --- a/static_assert_test_fail_2.cpp +++ b/static_assert_test_fail_2.cpp @@ -10,11 +10,13 @@ // // all these tests should fail: // +typedef char a1[2]; +typedef char a2[3]; // Function (block) scope void f() { - BOOST_STATIC_ASSERT(sizeof(int) == sizeof(char)); // should not compile + BOOST_STATIC_ASSERT(sizeof(a1) == sizeof(a2)); // should not compile } diff --git a/static_assert_test_fail_3.cpp b/static_assert_test_fail_3.cpp index 9bdfa6b..182658a 100644 --- a/static_assert_test_fail_3.cpp +++ b/static_assert_test_fail_3.cpp @@ -10,11 +10,13 @@ // // this tests should fail: // +typedef char a1[2]; +typedef char a2[3]; struct Bob { private: // can be in private, to avoid namespace pollution - BOOST_STATIC_ASSERT(sizeof(int) == sizeof(char)); // will not compile + BOOST_STATIC_ASSERT(sizeof(a1) == sizeof(a2)); // will not compile public: // Member function scope: provides access to member variables @@ -26,7 +28,6 @@ struct Bob BOOST_STATIC_ASSERT(sizeof(x) == 4); BOOST_STATIC_ASSERT(sizeof(c) == 1); #endif - //BOOST_STATIC_ASSERT((sizeof(x) == sizeof(c))); // should not compile return x; } }; diff --git a/static_assert_test_fail_4.cpp b/static_assert_test_fail_4.cpp index 02f8c6c..89c2732 100644 --- a/static_assert_test_fail_4.cpp +++ b/static_assert_test_fail_4.cpp @@ -18,7 +18,7 @@ struct Bob public: // Member function scope: provides access to member variables - int x; + char x[4]; char c; int f() {