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_PRIVATE_IN_AGGREGATE 9// TITLE: private in aggregate types 10// DESCRIPTION: The compiler misreads 8.5.1, treating classes 11// as non-aggregate if they contain private or 12// protected member functions. 13 14 15namespace boost_no_private_in_aggregate{ 16 17struct t 18{ 19private: 20 void foo(){ i = j; } 21public: 22 void uncallable(); // silences warning from GCC 23 int i; 24 int j; 25}; 26 27 28int test() 29{ 30 t inst = { 0, 0, }; 31 (void) &inst; // avoid "unused variable" warning 32 return 0; 33} 34 35} 36 37 38 39 40