Changed tests to guarantee portability

[SVN r22245]
This commit is contained in:
John Maddock
2004-02-12 11:29:47 +00:00
parent 328b4fee16
commit 68545773d5
4 changed files with 10 additions and 5 deletions

View File

@ -10,9 +10,11 @@
// //
// all these tests should fail: // all these tests should fail:
// //
typedef char a1[2];
typedef char a2[3];
// Namespace scope // Namespace scope
BOOST_STATIC_ASSERT(sizeof(int) == sizeof(char)); // will not compile BOOST_STATIC_ASSERT(sizeof(a1) == sizeof(a2)); // will not compile

View File

@ -10,11 +10,13 @@
// //
// all these tests should fail: // all these tests should fail:
// //
typedef char a1[2];
typedef char a2[3];
// Function (block) scope // Function (block) scope
void f() void f()
{ {
BOOST_STATIC_ASSERT(sizeof(int) == sizeof(char)); // should not compile BOOST_STATIC_ASSERT(sizeof(a1) == sizeof(a2)); // should not compile
} }

View File

@ -10,11 +10,13 @@
// //
// this tests should fail: // this tests should fail:
// //
typedef char a1[2];
typedef char a2[3];
struct Bob struct Bob
{ {
private: // can be in private, to avoid namespace pollution 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: public:
// Member function scope: provides access to member variables // Member function scope: provides access to member variables
@ -26,7 +28,6 @@ struct Bob
BOOST_STATIC_ASSERT(sizeof(x) == 4); BOOST_STATIC_ASSERT(sizeof(x) == 4);
BOOST_STATIC_ASSERT(sizeof(c) == 1); BOOST_STATIC_ASSERT(sizeof(c) == 1);
#endif #endif
//BOOST_STATIC_ASSERT((sizeof(x) == sizeof(c))); // should not compile
return x; return x;
} }
}; };

View File

@ -18,7 +18,7 @@ struct Bob
public: public:
// Member function scope: provides access to member variables // Member function scope: provides access to member variables
int x; char x[4];
char c; char c;
int f() int f()
{ {