• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//  (C) Copyright John Maddock 2001.
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/libs/config for most recent version.
7
8//  MACRO:         BOOST_NO_INCLASS_MEMBER_INITIALIZATION
9//  TITLE:         inline member constant initialisation
10//  DESCRIPTION:   Compiler violates std::9.4.2/4.
11
12
13namespace boost_no_inclass_member_initialization{
14
15struct UDT{};
16
17
18template <bool b1, bool b2, bool b3, bool b4, bool b5, bool b6, bool b7>
19struct ice_or_helper
20{
21   static const bool value = true;
22};
23template <>
24struct ice_or_helper<false, false, false, false, false, false, false>
25{
26   static const bool value = false;
27};
28
29template <bool b1, bool b2, bool b3 = false, bool b4 = false, bool b5 = false, bool b6 = false, bool b7 = false>
30struct ice_or
31{
32   static const bool value = ice_or_helper<b1, b2, b3, b4, b5, b6, b7>::value;
33};
34
35template <class T>
36struct is_int
37{
38   static const bool value = false;
39};
40
41template <>
42struct is_int<int>
43{
44   static const bool value = true;
45};
46
47#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)))
48#  define BOOST_UNUSED_ATTRIBUTE __attribute__((unused))
49#else
50#  define BOOST_UNUSED_ATTRIBUTE
51#endif
52
53
54int test()
55{
56   typedef int a1[ice_or< is_int<int>::value, is_int<UDT>::value>::value ? 1 : -1] BOOST_UNUSED_ATTRIBUTE;
57   return 0;
58}
59
60}
61
62#undef BOOST_UNUSED_ATTRIBUTE
63