PageRenderTime 36ms CodeModel.GetById 32ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/libs/static_assert/static_assert_test_fail_4.cpp

http://hadesmem.googlecode.com/
C++ | 38 lines | 17 code | 12 blank | 9 comment | 4 complexity | c0a808afdf875f72bcda76951f5a6ee9 MD5 | raw file
 1//  (C) Copyright Steve Cleary & John Maddock 2000.
 2//  Use, modification and distribution are subject to the 
 3//  Boost Software License, Version 1.0. (See accompanying file 
 4//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 5
 6//  See http://www.boost.org for most recent version including documentation.
 7
 8#include <boost/config.hpp>
 9#include <boost/static_assert.hpp>
10
11//
12// all these tests should fail:
13//
14
15
16struct Bob
17{
18  public:
19
20  // Member function scope: provides access to member variables
21  char x[4];
22  char c;
23  int f()
24  {
25#if !defined(BOOST_MSVC) || BOOST_MSVC > 1200 // broken sizeof in VC6
26    BOOST_STATIC_ASSERT(sizeof(x) == 4);
27    BOOST_STATIC_ASSERT(sizeof(c) == 1);
28    BOOST_STATIC_ASSERT((sizeof(x) == sizeof(c))); // should not compile
29#endif
30    return x;
31  }
32};
33
34
35
36
37
38