add BOOST_NO_DECLTYPE_N3276 config macro

[SVN r72327]
This commit is contained in:
Eric Niebler
2011-06-01 14:51:03 +00:00
parent c897810096
commit 1c37e1a994
28 changed files with 405 additions and 129 deletions
+4 -1
View File
@@ -1,7 +1,7 @@
#
# Regression test Jamfile for boost configuration setup.
# *** DO NOT EDIT THIS FILE BY HAND ***
# This file was automatically generated on Mon May 09 12:11:18 2011
# This file was automatically generated on Wed Jun 1 21:44:56 2011
# by libs/config/tools/generate.cpp
# Copyright John Maddock.
# Use, modification and distribution are subject to the
@@ -277,6 +277,9 @@ test-suite "BOOST_NO_CWCTYPE" :
test-suite "BOOST_NO_DECLTYPE" :
[ run ../no_decltype_pass.cpp ]
[ compile-fail ../no_decltype_fail.cpp ] ;
test-suite "BOOST_NO_DECLTYPE_N3276" :
[ run ../no_decltype_n3276_pass.cpp ]
[ compile-fail ../no_decltype_n3276_fail.cpp ] ;
test-suite "BOOST_DEDUCED_TYPENAME" :
[ run ../no_ded_typename_pass.cpp ]
[ compile-fail ../no_ded_typename_fail.cpp ] ;
+137
View File
@@ -0,0 +1,137 @@
// (C) Copyright Eric Niebler 2011
// 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 more information.
// MACRO: BOOST_NO_DECLTYPE_N3276
// TITLE: C++0x decltype v1.1 unavailable
// DESCRIPTION: The compiler does not support extensions to C++0x
// decltype as described in N3276 and accepted in Madrid,
// March 2011:
// <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3276.pdf>
namespace boost_no_decltype_n3276 {
// A simplified result_of implementation.
// that uses decltype.
template<typename Sig>
struct result_of;
template<typename T>
T& declvar();
// use decltype
template<typename Fun, typename T>
struct result_of<Fun(T)>
{
typedef decltype(declvar<Fun>()(declvar<T>())) type;
};
template<typename Fun, typename T, typename U>
struct result_of<Fun(T, U)>
{
typedef decltype(declvar<Fun>()(declvar<T>(), declvar<U>())) type;
};
// simple tuple type
template<typename A0 = void, typename A1 = void, typename A2 = void>
struct tuple;
template<typename A0>
struct tuple<A0, void, void>
{
A0 a0_;
tuple(A0 const &a0)
: a0_(a0)
{}
};
template<typename A0, typename A1>
struct tuple<A0, A1>
{
A0 a0_;
A1 a1_;
tuple(A0 const &a0, A1 const & a1)
: a0_(a0)
, a1_(a1)
{}
};
// A node in an expression tree
template<class Tag, class Args> // Args is a tuple.
struct Expr;
// A function object that builds expression nodes
template<class Tag>
struct MakeExpr
{
template<class T>
Expr<Tag, tuple<T> > operator()(T const & t) const
{
return Expr<Tag, tuple<T> >(tuple<T>(t));
}
template<class T, typename U>
Expr<Tag, tuple<T, U> > operator()(T const & t, U const & u) const
{
return Expr<Tag, tuple<T, U> >(tuple<T, U>(t, u));
}
};
// Here are tag types that encode in an expression node
// what operation created the node.
struct Terminal;
struct BinaryPlus;
struct FunctionCall;
typedef MakeExpr<Terminal> MakeTerminal;
typedef MakeExpr<BinaryPlus> MakeBinaryPlus;
typedef MakeExpr<FunctionCall> MakeFunctionCall;
template<class Tag, class Args>
struct Expr
{
Args args_;
explicit Expr(Args const & t) : args_(t) {}
// An overloaded operator+ that creates a binary plus node
template<typename RTag, typename RArgs>
typename result_of<MakeBinaryPlus(Expr, Expr<RTag, RArgs>)>::type
operator+(Expr<RTag, RArgs> const &right) const
{
return MakeBinaryPlus()(*this, right);
}
// An overloaded function call operator that creates a unary
// function call node
typename result_of<MakeFunctionCall(Expr)>::type
operator()() const
{
return MakeFunctionCall()(*this);
}
};
int test()
{
// This is a terminal in an expression tree
Expr<Terminal, tuple<int> > i = MakeTerminal()(42);
i + i; // OK, this creates a binary plus node.
i(); // OK, this creates a unary function-call node.
// NOTE: If N3276 has not been implemented, this
// line will set off an infinite cascade of template
// instantiations that will run the compiler out of
// memory.
return 0;
}
}
+5
View File
@@ -996,6 +996,7 @@ void print_boost_macros()
PRINT_MACRO(BOOST_NO_CWCHAR);
PRINT_MACRO(BOOST_NO_CWCTYPE);
PRINT_MACRO(BOOST_NO_DECLTYPE);
PRINT_MACRO(BOOST_NO_DECLTYPE_N3276);
PRINT_MACRO(BOOST_NO_DEFAULTED_FUNCTIONS);
PRINT_MACRO(BOOST_NO_DELETED_FUNCTIONS);
PRINT_MACRO(BOOST_NO_DEPENDENT_NESTED_DERIVATIONS);
@@ -1079,6 +1080,10 @@ void print_boost_macros()
// END GENERATED BLOCK
PRINT_MACRO(BOOST_INTEL);
+11 -1
View File
@@ -1,4 +1,4 @@
// This file was automatically generated on Mon May 09 12:11:18 2011
// This file was automatically generated on Wed Jun 1 21:44:56 2011
// by libs/config/tools/generate.cpp
// Copyright John Maddock 2002-4.
// Use, modification and distribution are subject to the
@@ -197,6 +197,11 @@ namespace boost_no_cwctype = empty_boost;
#else
namespace boost_no_decltype = empty_boost;
#endif
#ifndef BOOST_NO_DECLTYPE_N3276
#include "boost_no_decltype_n3276.ipp"
#else
namespace boost_no_decltype_n3276 = empty_boost;
#endif
#ifndef BOOST_DEDUCED_TYPENAME
#include "boost_no_ded_typename.ipp"
#else
@@ -1276,6 +1281,11 @@ int main( int, char *[] )
std::cerr << "Failed test for BOOST_NO_DECLTYPE at: " << __FILE__ << ":" << __LINE__ << std::endl;
++error_count;
}
if(0 != boost_no_decltype_n3276::test())
{
std::cerr << "Failed test for BOOST_NO_DECLTYPE_N3276 at: " << __FILE__ << ":" << __LINE__ << std::endl;
++error_count;
}
if(0 != boost_deduced_typename::test())
{
std::cerr << "Failed test for BOOST_DEDUCED_TYPENAME at: " << __FILE__ << ":" << __LINE__ << std::endl;
+37
View File
@@ -0,0 +1,37 @@
// This file was automatically generated on Wed Jun 1 21:44:56 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$
//
// Test file for macro BOOST_NO_DECLTYPE_N3276
// This file should not compile, if it does then
// BOOST_NO_DECLTYPE_N3276 should not be defined.
// See file boost_no_decltype_n3276.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_DECLTYPE_N3276
#include "boost_no_decltype_n3276.ipp"
#else
#error "this file should not compile"
#endif
int main( int, char *[] )
{
return boost_no_decltype_n3276::test();
}
+37
View File
@@ -0,0 +1,37 @@
// This file was automatically generated on Wed Jun 1 21:44:56 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$
//
// Test file for macro BOOST_NO_DECLTYPE_N3276
// This file should compile, if it does not then
// BOOST_NO_DECLTYPE_N3276 should be defined.
// See file boost_no_decltype_n3276.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_DECLTYPE_N3276
#include "boost_no_decltype_n3276.ipp"
#else
namespace boost_no_decltype_n3276 = empty_boost;
#endif
int main( int, char *[] )
{
return boost_no_decltype_n3276::test();
}