forked from boostorg/config
Add needed missing files.
[SVN r72043]
This commit is contained in:
53
test/boost_no_unified_init.ipp
Normal file
53
test/boost_no_unified_init.ipp
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
// Copyright (C) 2011 John Maddock
|
||||||
|
// Use, modification and distribution are subject to the
|
||||||
|
// Boost Software License, Version 1.0. (See accompanying file
|
||||||
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
// See http://www.boost.org/libs/config for most recent version.
|
||||||
|
|
||||||
|
// MACRO: BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX
|
||||||
|
// TITLE: C++0x unified initialization syntax unavailable
|
||||||
|
// DESCRIPTION: The compiler does not support C++0x unified initialization syntax: see http://en.wikipedia.org/wiki/C%2B%2B0x#Uniform_initialization
|
||||||
|
|
||||||
|
namespace boost_no_unified_initialization_syntax {
|
||||||
|
|
||||||
|
struct BasicStruct
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
double y;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AltStruct
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AltStruct(int x, double y) : x_{x}, y_{y} {}
|
||||||
|
private:
|
||||||
|
int x_;
|
||||||
|
double y_;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct IdString
|
||||||
|
{
|
||||||
|
std::string name;
|
||||||
|
int identifier;
|
||||||
|
bool operator == (const IdString& other)
|
||||||
|
{
|
||||||
|
return identifier == other.identifier && name == other.name;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
IdString get_string()
|
||||||
|
{
|
||||||
|
return {"SomeName", 4}; //Note the lack of explicit type.
|
||||||
|
}
|
||||||
|
|
||||||
|
int test()
|
||||||
|
{
|
||||||
|
BasicStruct var1{5, 3.2};
|
||||||
|
AltStruct var2{2, 4.3};
|
||||||
|
|
||||||
|
IdString id{"SomeName", 4};
|
||||||
|
return id == get_string() ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
37
test/no_unified_init_fail.cpp
Normal file
37
test/no_unified_init_fail.cpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// This file was automatically generated on Mon May 09 12:11:17 2011
|
||||||
|
// by libs/config/tools/generate.cpp
|
||||||
|
// Copyright John Maddock 2002-4.
|
||||||
|
// Use, modification and distribution are subject to the
|
||||||
|
// Boost Software License, Version 1.0. (See accompanying file
|
||||||
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
// See http://www.boost.org/libs/config for the most recent version.//
|
||||||
|
// Revision $Id: generate.cpp 70001 2011-03-15 13:17:46Z johnmaddock $
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
// Test file for macro BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX
|
||||||
|
// This file should not compile, if it does then
|
||||||
|
// BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX should not be defined.
|
||||||
|
// See file boost_no_unified_init.ipp for details
|
||||||
|
|
||||||
|
// Must not have BOOST_ASSERT_CONFIG set; it defeats
|
||||||
|
// the objective of this file:
|
||||||
|
#ifdef BOOST_ASSERT_CONFIG
|
||||||
|
# undef BOOST_ASSERT_CONFIG
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include "test.hpp"
|
||||||
|
|
||||||
|
#ifdef BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX
|
||||||
|
#include "boost_no_unified_init.ipp"
|
||||||
|
#else
|
||||||
|
#error "this file should not compile"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int main( int, char *[] )
|
||||||
|
{
|
||||||
|
return boost_no_unified_initialization_syntax::test();
|
||||||
|
}
|
||||||
|
|
37
test/no_unified_init_pass.cpp
Normal file
37
test/no_unified_init_pass.cpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// This file was automatically generated on Mon May 09 12:11:17 2011
|
||||||
|
// by libs/config/tools/generate.cpp
|
||||||
|
// Copyright John Maddock 2002-4.
|
||||||
|
// Use, modification and distribution are subject to the
|
||||||
|
// Boost Software License, Version 1.0. (See accompanying file
|
||||||
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
// See http://www.boost.org/libs/config for the most recent version.//
|
||||||
|
// Revision $Id: generate.cpp 70001 2011-03-15 13:17:46Z johnmaddock $
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
// Test file for macro BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX
|
||||||
|
// This file should compile, if it does not then
|
||||||
|
// BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX should be defined.
|
||||||
|
// See file boost_no_unified_init.ipp for details
|
||||||
|
|
||||||
|
// Must not have BOOST_ASSERT_CONFIG set; it defeats
|
||||||
|
// the objective of this file:
|
||||||
|
#ifdef BOOST_ASSERT_CONFIG
|
||||||
|
# undef BOOST_ASSERT_CONFIG
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include "test.hpp"
|
||||||
|
|
||||||
|
#ifndef BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX
|
||||||
|
#include "boost_no_unified_init.ipp"
|
||||||
|
#else
|
||||||
|
namespace boost_no_unified_initialization_syntax = empty_boost;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int main( int, char *[] )
|
||||||
|
{
|
||||||
|
return boost_no_unified_initialization_syntax::test();
|
||||||
|
}
|
||||||
|
|
Reference in New Issue
Block a user