From 85751c6911e9c392730f554d6f956c7e7ac7a977 Mon Sep 17 00:00:00 2001 From: Lorenzo Caminiti Date: Wed, 21 Mar 2012 17:32:36 +0000 Subject: [PATCH] Added BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS macro to Boost.Config, updated tests and docs. (Plus I had to run dos2unix on auto generated config_info.cpp because of "inconsistent line ending" SVN error...) [SVN r77457] --- doc/macro_reference.qbk | 5 + include/boost/config/compiler/borland.hpp | 1 + include/boost/config/compiler/clang.hpp | 4 + include/boost/config/compiler/codegear.hpp | 1 + include/boost/config/compiler/common_edg.hpp | 1 + include/boost/config/compiler/cray.hpp | 1 + include/boost/config/compiler/digitalmars.hpp | 1 + include/boost/config/compiler/gcc.hpp | 1 + include/boost/config/compiler/gcc_xml.hpp | 1 + include/boost/config/compiler/hp_acc.hpp | 1 + include/boost/config/compiler/intel.hpp | 2 + include/boost/config/compiler/metrowerks.hpp | 1 + include/boost/config/compiler/mpw.hpp | 1 + include/boost/config/compiler/pathscale.hpp | 1 + include/boost/config/compiler/pgi.hpp | 1 + include/boost/config/compiler/sunpro_cc.hpp | 1 + include/boost/config/compiler/vacpp.hpp | 1 + include/boost/config/compiler/visualc.hpp | 1 + test/all/Jamfile.v2 | 101 +++--- test/boost_no_tem_local_classes.ipp | 33 ++ test/config_info.cpp | 32 +- test/config_test.cpp | 332 +++++++++--------- test/no_tem_local_classes_fail.cpp | 37 ++ test/no_tem_local_classes_pass.cpp | 37 ++ 24 files changed, 373 insertions(+), 225 deletions(-) create mode 100644 test/boost_no_tem_local_classes.ipp create mode 100644 test/no_tem_local_classes_fail.cpp create mode 100644 test/no_tem_local_classes_pass.cpp diff --git a/doc/macro_reference.qbk b/doc/macro_reference.qbk index e4413b72..4ee9c5a3 100644 --- a/doc/macro_reference.qbk +++ b/doc/macro_reference.qbk @@ -598,6 +598,11 @@ default template arguments for function templates. ]] [[`BOOST_NO_LAMBDAS`][The compiler does not support Lambdas. ]] +[[`BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS`][The compiler does not support +local classes as template parameters (this macro intentionally does not +control support for unnamed types as template parameters, see also +[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm N2657]). +]] [[`BOOST_NO_LONG_LONG`][The compiler does not support `long long`. ]] [[`BOOST_NO_NOEXCEPT`][The compiler does not support `noexcept`. diff --git a/include/boost/config/compiler/borland.hpp b/include/boost/config/compiler/borland.hpp index 102c87d0..5917afd4 100644 --- a/include/boost/config/compiler/borland.hpp +++ b/include/boost/config/compiler/borland.hpp @@ -178,6 +178,7 @@ #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_CXX11_HDR_INITIALIZER_LIST #define BOOST_NO_LAMBDAS +#define BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS #define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES diff --git a/include/boost/config/compiler/clang.hpp b/include/boost/config/compiler/clang.hpp index 9f1c2cd1..036eadc3 100644 --- a/include/boost/config/compiler/clang.hpp +++ b/include/boost/config/compiler/clang.hpp @@ -72,6 +72,10 @@ # define BOOST_NO_LAMBDAS #endif +#if __clang_major__ < 2 || (__clang_major__ == 2 && __clang_minor__ < 9) +# define BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS // From version 2.9 on. +#endif + #if !__has_feature(cxx_noexcept) # define BOOST_NO_NOEXCEPT #endif diff --git a/include/boost/config/compiler/codegear.hpp b/include/boost/config/compiler/codegear.hpp index fc1b8169..27040049 100644 --- a/include/boost/config/compiler/codegear.hpp +++ b/include/boost/config/compiler/codegear.hpp @@ -99,6 +99,7 @@ #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_LAMBDAS +#define BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS #define BOOST_NO_NOEXCEPT #define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS diff --git a/include/boost/config/compiler/common_edg.hpp b/include/boost/config/compiler/common_edg.hpp index 1b0684c0..a615a35b 100644 --- a/include/boost/config/compiler/common_edg.hpp +++ b/include/boost/config/compiler/common_edg.hpp @@ -82,6 +82,7 @@ #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_LAMBDAS +#define BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS #define BOOST_NO_NOEXCEPT #define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS diff --git a/include/boost/config/compiler/cray.hpp b/include/boost/config/compiler/cray.hpp index ad2eeaf5..134275e5 100644 --- a/include/boost/config/compiler/cray.hpp +++ b/include/boost/config/compiler/cray.hpp @@ -42,6 +42,7 @@ #define BOOST_NO_NULLPTR #define BOOST_NO_NOEXCEPT #define BOOST_NO_LAMBDAS +#define BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_DELETED_FUNCTIONS diff --git a/include/boost/config/compiler/digitalmars.hpp b/include/boost/config/compiler/digitalmars.hpp index bd7b1843..7386be7d 100644 --- a/include/boost/config/compiler/digitalmars.hpp +++ b/include/boost/config/compiler/digitalmars.hpp @@ -73,6 +73,7 @@ #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_CXX11_HDR_INITIALIZER_LIST #define BOOST_NO_LAMBDAS +#define BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS #define BOOST_NO_NOEXCEPT #define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS diff --git a/include/boost/config/compiler/gcc.hpp b/include/boost/config/compiler/gcc.hpp index f6c82eb1..e4524a6a 100644 --- a/include/boost/config/compiler/gcc.hpp +++ b/include/boost/config/compiler/gcc.hpp @@ -196,6 +196,7 @@ #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__) # define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS # define BOOST_NO_LAMBDAS +# define BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS # define BOOST_NO_RAW_LITERALS # define BOOST_NO_UNICODE_LITERALS #endif diff --git a/include/boost/config/compiler/gcc_xml.hpp b/include/boost/config/compiler/gcc_xml.hpp index 2a639594..69905ae7 100644 --- a/include/boost/config/compiler/gcc_xml.hpp +++ b/include/boost/config/compiler/gcc_xml.hpp @@ -49,6 +49,7 @@ # define BOOST_NO_SCOPED_ENUMS # define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS # define BOOST_NO_LAMBDAS +# define BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS # define BOOST_NO_RAW_LITERALS # define BOOST_NO_UNICODE_LITERALS # define BOOST_NO_NOEXCEPT diff --git a/include/boost/config/compiler/hp_acc.hpp b/include/boost/config/compiler/hp_acc.hpp index 050421b7..d8cfb8cc 100644 --- a/include/boost/config/compiler/hp_acc.hpp +++ b/include/boost/config/compiler/hp_acc.hpp @@ -106,6 +106,7 @@ #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_CXX11_HDR_INITIALIZER_LIST #define BOOST_NO_LAMBDAS +#define BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS #define BOOST_NO_NOEXCEPT #define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS diff --git a/include/boost/config/compiler/intel.hpp b/include/boost/config/compiler/intel.hpp index 9921674b..11909403 100644 --- a/include/boost/config/compiler/intel.hpp +++ b/include/boost/config/compiler/intel.hpp @@ -205,6 +205,7 @@ template<> struct assert_intrinsic_wchar_t {}; // http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler/ // //# undef BOOST_NO_LAMBDAS +//# undef BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS //# undef BOOST_NO_DECLTYPE //# undef BOOST_NO_AUTO_DECLARATIONS //# undef BOOST_NO_AUTO_MULTIDECLARATIONS @@ -216,6 +217,7 @@ template<> struct assert_intrinsic_wchar_t {}; # undef BOOST_NO_DELETED_FUNCTIONS # undef BOOST_NO_DEFAULTED_FUNCTIONS # undef BOOST_NO_LAMBDAS +# undef BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS # undef BOOST_NO_DECLTYPE # undef BOOST_NO_AUTO_DECLARATIONS # undef BOOST_NO_AUTO_MULTIDECLARATIONS diff --git a/include/boost/config/compiler/metrowerks.hpp b/include/boost/config/compiler/metrowerks.hpp index e2b82937..4a1edd47 100644 --- a/include/boost/config/compiler/metrowerks.hpp +++ b/include/boost/config/compiler/metrowerks.hpp @@ -106,6 +106,7 @@ #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_CXX11_HDR_INITIALIZER_LIST #define BOOST_NO_LAMBDAS +#define BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS #define BOOST_NO_NOEXCEPT #define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS diff --git a/include/boost/config/compiler/mpw.hpp b/include/boost/config/compiler/mpw.hpp index 942ce020..f328b3bb 100644 --- a/include/boost/config/compiler/mpw.hpp +++ b/include/boost/config/compiler/mpw.hpp @@ -54,6 +54,7 @@ #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_CXX11_HDR_INITIALIZER_LIST #define BOOST_NO_LAMBDAS +#define BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS #define BOOST_NO_NOEXCEPT #define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS diff --git a/include/boost/config/compiler/pathscale.hpp b/include/boost/config/compiler/pathscale.hpp index 4dd5eed9..f5fe6e83 100644 --- a/include/boost/config/compiler/pathscale.hpp +++ b/include/boost/config/compiler/pathscale.hpp @@ -45,6 +45,7 @@ # define BOOST_NO_NUMERIC_LIMITS_LOWEST # define BOOST_NO_NOEXCEPT # define BOOST_NO_LAMBDAS +# define BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS # define BOOST_NO_MS_INT64_NUMERIC_LIMITS # define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS # define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS diff --git a/include/boost/config/compiler/pgi.hpp b/include/boost/config/compiler/pgi.hpp index 18c5f9d4..a85e7a2f 100644 --- a/include/boost/config/compiler/pgi.hpp +++ b/include/boost/config/compiler/pgi.hpp @@ -76,6 +76,7 @@ #define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_LAMBDAS +#define BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS #define BOOST_NO_NOEXCEPT #define BOOST_NO_NULLPTR #define BOOST_NO_NUMERIC_LIMITS_LOWEST diff --git a/include/boost/config/compiler/sunpro_cc.hpp b/include/boost/config/compiler/sunpro_cc.hpp index d9126c70..7d298e6c 100644 --- a/include/boost/config/compiler/sunpro_cc.hpp +++ b/include/boost/config/compiler/sunpro_cc.hpp @@ -113,6 +113,7 @@ #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_CXX11_HDR_INITIALIZER_LIST #define BOOST_NO_LAMBDAS +#define BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS #define BOOST_NO_NOEXCEPT #define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS diff --git a/include/boost/config/compiler/vacpp.hpp b/include/boost/config/compiler/vacpp.hpp index 36cd1b1e..bad10711 100644 --- a/include/boost/config/compiler/vacpp.hpp +++ b/include/boost/config/compiler/vacpp.hpp @@ -97,6 +97,7 @@ #endif #define BOOST_NO_CXX11_HDR_INITIALIZER_LIST #define BOOST_NO_LAMBDAS +#define BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS #define BOOST_NO_NOEXCEPT #define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS diff --git a/include/boost/config/compiler/visualc.hpp b/include/boost/config/compiler/visualc.hpp index 8e2fdbb1..8075e4df 100644 --- a/include/boost/config/compiler/visualc.hpp +++ b/include/boost/config/compiler/visualc.hpp @@ -196,6 +196,7 @@ # define BOOST_NO_AUTO_DECLARATIONS # define BOOST_NO_AUTO_MULTIDECLARATIONS # define BOOST_NO_LAMBDAS +# define BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS # define BOOST_NO_RVALUE_REFERENCES # define BOOST_NO_STATIC_ASSERT # define BOOST_NO_NULLPTR diff --git a/test/all/Jamfile.v2 b/test/all/Jamfile.v2 index 91904747..149538e8 100644 --- a/test/all/Jamfile.v2 +++ b/test/all/Jamfile.v2 @@ -1,7 +1,7 @@ # # Regression test Jamfile for boost configuration setup. # *** DO NOT EDIT THIS FILE BY HAND *** -# This file was automatically generated on Sun Nov 27 09:43:19 2011 +# This file was automatically generated on Wed Mar 21 13:05:19 2012 # by libs/config/tools/generate.cpp # Copyright John Maddock. # Use, modification and distribution are subject to the @@ -175,6 +175,54 @@ test-suite "BOOST_MSVC_STD_ITERATOR" : test-suite "BOOST_HAS_WINTHREADS" : [ run ../has_winthreads_pass.cpp ] [ compile-fail ../has_winthreads_fail.cpp ] ; +test-suite "BOOST_NO_ADL_BARRIER" : +[ run ../no_adl_barrier_pass.cpp ] +[ compile-fail ../no_adl_barrier_fail.cpp ] ; +test-suite "BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP" : +[ run ../no_arg_dep_lookup_pass.cpp ] +[ compile-fail ../no_arg_dep_lookup_fail.cpp ] ; +test-suite "BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS" : +[ run ../no_array_type_spec_pass.cpp ] +[ compile-fail ../no_array_type_spec_fail.cpp ] ; +test-suite "BOOST_NO_AUTO_DECLARATIONS" : +[ run ../no_auto_declarations_pass.cpp ] +[ compile-fail ../no_auto_declarations_fail.cpp ] ; +test-suite "BOOST_NO_AUTO_MULTIDECLARATIONS" : +[ run ../no_auto_multidecl_pass.cpp ] +[ compile-fail ../no_auto_multidecl_fail.cpp ] ; +test-suite "BOOST_NO_AUTO_PTR" : +[ run ../no_auto_ptr_pass.cpp ] +[ compile-fail ../no_auto_ptr_fail.cpp ] ; +test-suite "BOOST_BCB_PARTIAL_SPECIALIZATION_BUG" : +[ run ../no_bcb_partial_spec_pass.cpp ] +[ compile-fail ../no_bcb_partial_spec_fail.cpp ] ; +test-suite "BOOST_NO_CHAR16_T" : +[ run ../no_char16_t_pass.cpp ] +[ compile-fail ../no_char16_t_fail.cpp ] ; +test-suite "BOOST_NO_CHAR32_T" : +[ run ../no_char32_t_pass.cpp ] +[ compile-fail ../no_char32_t_fail.cpp ] ; +test-suite "BOOST_NO_COMPLETE_VALUE_INITIALIZATION" : +[ run ../no_com_value_init_pass.cpp ] +[ compile-fail ../no_com_value_init_fail.cpp ] ; +test-suite "BOOST_NO_CONSTEXPR" : +[ run ../no_constexpr_pass.cpp ] +[ compile-fail ../no_constexpr_fail.cpp ] ; +test-suite "BOOST_NO_CTYPE_FUNCTIONS" : +[ run ../no_ctype_functions_pass.cpp ] +[ compile-fail ../no_ctype_functions_fail.cpp ] ; +test-suite "BOOST_NO_CV_SPECIALIZATIONS" : +[ run ../no_cv_spec_pass.cpp ] +[ compile-fail ../no_cv_spec_fail.cpp ] ; +test-suite "BOOST_NO_CV_VOID_SPECIALIZATIONS" : +[ run ../no_cv_void_spec_pass.cpp ] +[ compile-fail ../no_cv_void_spec_fail.cpp ] ; +test-suite "BOOST_NO_CWCHAR" : +[ run ../no_cwchar_pass.cpp ] +[ compile-fail ../no_cwchar_fail.cpp ] ; +test-suite "BOOST_NO_CWCTYPE" : +[ run ../no_cwctype_pass.cpp ] +[ compile-fail ../no_cwctype_fail.cpp ] ; test-suite "BOOST_NO_CXX11_HDR_ARRAY" : [ run ../no_cxx11_hdr_array_pass.cpp ] [ compile-fail ../no_cxx11_hdr_array_fail.cpp ] ; @@ -229,54 +277,6 @@ test-suite "BOOST_NO_CXX11_HDR_UNORDERED_MAP" : test-suite "BOOST_NO_CXX11_HDR_UNORDERED_SET" : [ run ../no_cxx11_hdr_unordered_set_pass.cpp ] [ compile-fail ../no_cxx11_hdr_unordered_set_fail.cpp ] ; -test-suite "BOOST_NO_ADL_BARRIER" : -[ run ../no_adl_barrier_pass.cpp ] -[ compile-fail ../no_adl_barrier_fail.cpp ] ; -test-suite "BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP" : -[ run ../no_arg_dep_lookup_pass.cpp ] -[ compile-fail ../no_arg_dep_lookup_fail.cpp ] ; -test-suite "BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS" : -[ run ../no_array_type_spec_pass.cpp ] -[ compile-fail ../no_array_type_spec_fail.cpp ] ; -test-suite "BOOST_NO_AUTO_DECLARATIONS" : -[ run ../no_auto_declarations_pass.cpp ] -[ compile-fail ../no_auto_declarations_fail.cpp ] ; -test-suite "BOOST_NO_AUTO_MULTIDECLARATIONS" : -[ run ../no_auto_multidecl_pass.cpp ] -[ compile-fail ../no_auto_multidecl_fail.cpp ] ; -test-suite "BOOST_NO_AUTO_PTR" : -[ run ../no_auto_ptr_pass.cpp ] -[ compile-fail ../no_auto_ptr_fail.cpp ] ; -test-suite "BOOST_BCB_PARTIAL_SPECIALIZATION_BUG" : -[ run ../no_bcb_partial_spec_pass.cpp ] -[ compile-fail ../no_bcb_partial_spec_fail.cpp ] ; -test-suite "BOOST_NO_CHAR16_T" : -[ run ../no_char16_t_pass.cpp ] -[ compile-fail ../no_char16_t_fail.cpp ] ; -test-suite "BOOST_NO_CHAR32_T" : -[ run ../no_char32_t_pass.cpp ] -[ compile-fail ../no_char32_t_fail.cpp ] ; -test-suite "BOOST_NO_COMPLETE_VALUE_INITIALIZATION" : -[ run ../no_com_value_init_pass.cpp ] -[ compile-fail ../no_com_value_init_fail.cpp ] ; -test-suite "BOOST_NO_CONSTEXPR" : -[ run ../no_constexpr_pass.cpp ] -[ compile-fail ../no_constexpr_fail.cpp ] ; -test-suite "BOOST_NO_CTYPE_FUNCTIONS" : -[ run ../no_ctype_functions_pass.cpp ] -[ compile-fail ../no_ctype_functions_fail.cpp ] ; -test-suite "BOOST_NO_CV_SPECIALIZATIONS" : -[ run ../no_cv_spec_pass.cpp ] -[ compile-fail ../no_cv_spec_fail.cpp ] ; -test-suite "BOOST_NO_CV_VOID_SPECIALIZATIONS" : -[ run ../no_cv_void_spec_pass.cpp ] -[ compile-fail ../no_cv_void_spec_fail.cpp ] ; -test-suite "BOOST_NO_CWCHAR" : -[ run ../no_cwchar_pass.cpp ] -[ compile-fail ../no_cwchar_fail.cpp ] ; -test-suite "BOOST_NO_CWCTYPE" : -[ run ../no_cwctype_pass.cpp ] -[ compile-fail ../no_cwctype_fail.cpp ] ; test-suite "BOOST_NO_DECLTYPE" : [ run ../no_decltype_pass.cpp ] [ compile-fail ../no_decltype_fail.cpp ] ; @@ -484,6 +484,9 @@ test-suite "BOOST_NO_TEMPLATED_IOSTREAMS" : test-suite "BOOST_NO_TEMPLATE_TEMPLATES" : [ run ../no_template_template_pass.cpp ] [ compile-fail ../no_template_template_fail.cpp ] ; +test-suite "BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS" : +[ run ../no_tem_local_classes_pass.cpp ] +[ compile-fail ../no_tem_local_classes_fail.cpp ] ; test-suite "BOOST_NO_TWO_PHASE_NAME_LOOKUP" : [ run ../no_two_phase_lookup_pass.cpp ] [ compile-fail ../no_two_phase_lookup_fail.cpp ] ; diff --git a/test/boost_no_tem_local_classes.ipp b/test/boost_no_tem_local_classes.ipp new file mode 100644 index 00000000..ed5e701d --- /dev/null +++ b/test/boost_no_tem_local_classes.ipp @@ -0,0 +1,33 @@ + +// Copyright (C) 2009-2012 Lorenzo Caminiti +// Distributed under the Boost Software License, Version 1.0 +// (see accompanying file LICENSE_1_0.txt or a copy at +// http://www.boost.org/LICENSE_1_0.txt) +// Home at http://www.boost.org/libs/config + +// MACRO: BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS +// TITLE: local classes as template parameters +// DESCRIPTION: Local classes cannot be passed as template parameters. + +// NOTE: Local classes cannot be passed as template parameters in C++03 (even +// if some C++03 compilers, like MSVC and older GCC, allow it). Local classes +// can instead be passed as template parameters in C++11 (see also N2657, note +// that this macro does not check if unnamed types can also be passed as +// template parameters but it is intentionally limited to local named classes +// because some non C++11 compilers might only support local named classes as +// template parameters which is still very useful to program local functors). +namespace boost_no_local_class_template_parameters { + +template struct a { void use() {} }; +template void f(T x) {} + +int test() { + class local_class {} local_obj; + a a1; + a1.use(); // Avoid unused variable warning. + f(local_obj); + return 0; +} + +} // namespace + diff --git a/test/config_info.cpp b/test/config_info.cpp index 594b283f..708c8ac6 100644 --- a/test/config_info.cpp +++ b/test/config_info.cpp @@ -979,6 +979,21 @@ void print_boost_macros() PRINT_MACRO(BOOST_HAS_WINTHREADS); PRINT_MACRO(BOOST_MSVC6_MEMBER_TEMPLATES); PRINT_MACRO(BOOST_MSVC_STD_ITERATOR); + PRINT_MACRO(BOOST_NO_ADL_BARRIER); + PRINT_MACRO(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP); + PRINT_MACRO(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS); + PRINT_MACRO(BOOST_NO_AUTO_DECLARATIONS); + PRINT_MACRO(BOOST_NO_AUTO_MULTIDECLARATIONS); + PRINT_MACRO(BOOST_NO_AUTO_PTR); + PRINT_MACRO(BOOST_NO_CHAR16_T); + PRINT_MACRO(BOOST_NO_CHAR32_T); + PRINT_MACRO(BOOST_NO_COMPLETE_VALUE_INITIALIZATION); + PRINT_MACRO(BOOST_NO_CONSTEXPR); + PRINT_MACRO(BOOST_NO_CTYPE_FUNCTIONS); + PRINT_MACRO(BOOST_NO_CV_SPECIALIZATIONS); + PRINT_MACRO(BOOST_NO_CV_VOID_SPECIALIZATIONS); + PRINT_MACRO(BOOST_NO_CWCHAR); + PRINT_MACRO(BOOST_NO_CWCTYPE); PRINT_MACRO(BOOST_NO_CXX11_HDR_ARRAY); PRINT_MACRO(BOOST_NO_CXX11_HDR_CHRONO); PRINT_MACRO(BOOST_NO_CXX11_HDR_CODECVT); @@ -997,21 +1012,6 @@ void print_boost_macros() PRINT_MACRO(BOOST_NO_CXX11_HDR_TYPE_TRAITS); PRINT_MACRO(BOOST_NO_CXX11_HDR_UNORDERED_MAP); PRINT_MACRO(BOOST_NO_CXX11_HDR_UNORDERED_SET); - PRINT_MACRO(BOOST_NO_ADL_BARRIER); - PRINT_MACRO(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP); - PRINT_MACRO(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS); - PRINT_MACRO(BOOST_NO_AUTO_DECLARATIONS); - PRINT_MACRO(BOOST_NO_AUTO_MULTIDECLARATIONS); - PRINT_MACRO(BOOST_NO_AUTO_PTR); - PRINT_MACRO(BOOST_NO_CHAR16_T); - PRINT_MACRO(BOOST_NO_CHAR32_T); - PRINT_MACRO(BOOST_NO_COMPLETE_VALUE_INITIALIZATION); - PRINT_MACRO(BOOST_NO_CONSTEXPR); - PRINT_MACRO(BOOST_NO_CTYPE_FUNCTIONS); - PRINT_MACRO(BOOST_NO_CV_SPECIALIZATIONS); - PRINT_MACRO(BOOST_NO_CV_VOID_SPECIALIZATIONS); - 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); @@ -1036,6 +1036,7 @@ void print_boost_macros() PRINT_MACRO(BOOST_NO_LAMBDAS); PRINT_MACRO(BOOST_NO_LIMITS); PRINT_MACRO(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS); + PRINT_MACRO(BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS); PRINT_MACRO(BOOST_NO_LONG_LONG); PRINT_MACRO(BOOST_NO_LONG_LONG_NUMERIC_LIMITS); PRINT_MACRO(BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS); @@ -1105,6 +1106,7 @@ void print_boost_macros() + // END GENERATED BLOCK PRINT_MACRO(BOOST_INTEL); diff --git a/test/config_test.cpp b/test/config_test.cpp index 4e5b91ce..7d3c2c5b 100644 --- a/test/config_test.cpp +++ b/test/config_test.cpp @@ -1,4 +1,4 @@ -// This file was automatically generated on Sun Nov 27 09:43:19 2011 +// This file was automatically generated on Wed Mar 21 13:05:19 2012 // by libs/config/tools/generate.cpp // Copyright John Maddock 2002-4. // Use, modification and distribution are subject to the @@ -22,6 +22,86 @@ int error_count = 0; +#ifndef BOOST_NO_ADL_BARRIER +#include "boost_no_adl_barrier.ipp" +#else +namespace boost_no_adl_barrier = empty_boost; +#endif +#ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP +#include "boost_no_arg_dep_lookup.ipp" +#else +namespace boost_no_argument_dependent_lookup = empty_boost; +#endif +#ifndef BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS +#include "boost_no_array_type_spec.ipp" +#else +namespace boost_no_array_type_specializations = empty_boost; +#endif +#ifndef BOOST_NO_AUTO_DECLARATIONS +#include "boost_no_auto_declarations.ipp" +#else +namespace boost_no_auto_declarations = empty_boost; +#endif +#ifndef BOOST_NO_AUTO_MULTIDECLARATIONS +#include "boost_no_auto_multidecl.ipp" +#else +namespace boost_no_auto_multideclarations = empty_boost; +#endif +#ifndef BOOST_NO_AUTO_PTR +#include "boost_no_auto_ptr.ipp" +#else +namespace boost_no_auto_ptr = empty_boost; +#endif +#ifndef BOOST_BCB_PARTIAL_SPECIALIZATION_BUG +#include "boost_no_bcb_partial_spec.ipp" +#else +namespace boost_bcb_partial_specialization_bug = empty_boost; +#endif +#ifndef BOOST_NO_CHAR16_T +#include "boost_no_char16_t.ipp" +#else +namespace boost_no_char16_t = empty_boost; +#endif +#ifndef BOOST_NO_CHAR32_T +#include "boost_no_char32_t.ipp" +#else +namespace boost_no_char32_t = empty_boost; +#endif +#ifndef BOOST_NO_COMPLETE_VALUE_INITIALIZATION +#include "boost_no_com_value_init.ipp" +#else +namespace boost_no_complete_value_initialization = empty_boost; +#endif +#ifndef BOOST_NO_CONSTEXPR +#include "boost_no_constexpr.ipp" +#else +namespace boost_no_constexpr = empty_boost; +#endif +#ifndef BOOST_NO_CTYPE_FUNCTIONS +#include "boost_no_ctype_functions.ipp" +#else +namespace boost_no_ctype_functions = empty_boost; +#endif +#ifndef BOOST_NO_CV_SPECIALIZATIONS +#include "boost_no_cv_spec.ipp" +#else +namespace boost_no_cv_specializations = empty_boost; +#endif +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +#include "boost_no_cv_void_spec.ipp" +#else +namespace boost_no_cv_void_specializations = empty_boost; +#endif +#ifndef BOOST_NO_CWCHAR +#include "boost_no_cwchar.ipp" +#else +namespace boost_no_cwchar = empty_boost; +#endif +#ifndef BOOST_NO_CWCTYPE +#include "boost_no_cwctype.ipp" +#else +namespace boost_no_cwctype = empty_boost; +#endif #ifndef BOOST_NO_CXX11_HDR_ARRAY #include "boost_no_cxx11_hdr_array.ipp" #else @@ -112,86 +192,6 @@ namespace boost_no_cxx11_hdr_unordered_map = empty_boost; #else namespace boost_no_cxx11_hdr_unordered_set = empty_boost; #endif -#ifndef BOOST_NO_ADL_BARRIER -#include "boost_no_adl_barrier.ipp" -#else -namespace boost_no_adl_barrier = empty_boost; -#endif -#ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP -#include "boost_no_arg_dep_lookup.ipp" -#else -namespace boost_no_argument_dependent_lookup = empty_boost; -#endif -#ifndef BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS -#include "boost_no_array_type_spec.ipp" -#else -namespace boost_no_array_type_specializations = empty_boost; -#endif -#ifndef BOOST_NO_AUTO_DECLARATIONS -#include "boost_no_auto_declarations.ipp" -#else -namespace boost_no_auto_declarations = empty_boost; -#endif -#ifndef BOOST_NO_AUTO_MULTIDECLARATIONS -#include "boost_no_auto_multidecl.ipp" -#else -namespace boost_no_auto_multideclarations = empty_boost; -#endif -#ifndef BOOST_NO_AUTO_PTR -#include "boost_no_auto_ptr.ipp" -#else -namespace boost_no_auto_ptr = empty_boost; -#endif -#ifndef BOOST_BCB_PARTIAL_SPECIALIZATION_BUG -#include "boost_no_bcb_partial_spec.ipp" -#else -namespace boost_bcb_partial_specialization_bug = empty_boost; -#endif -#ifndef BOOST_NO_CHAR16_T -#include "boost_no_char16_t.ipp" -#else -namespace boost_no_char16_t = empty_boost; -#endif -#ifndef BOOST_NO_CHAR32_T -#include "boost_no_char32_t.ipp" -#else -namespace boost_no_char32_t = empty_boost; -#endif -#ifndef BOOST_NO_COMPLETE_VALUE_INITIALIZATION -#include "boost_no_com_value_init.ipp" -#else -namespace boost_no_complete_value_initialization = empty_boost; -#endif -#ifndef BOOST_NO_CONSTEXPR -#include "boost_no_constexpr.ipp" -#else -namespace boost_no_constexpr = empty_boost; -#endif -#ifndef BOOST_NO_CTYPE_FUNCTIONS -#include "boost_no_ctype_functions.ipp" -#else -namespace boost_no_ctype_functions = empty_boost; -#endif -#ifndef BOOST_NO_CV_SPECIALIZATIONS -#include "boost_no_cv_spec.ipp" -#else -namespace boost_no_cv_specializations = empty_boost; -#endif -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -#include "boost_no_cv_void_spec.ipp" -#else -namespace boost_no_cv_void_specializations = empty_boost; -#endif -#ifndef BOOST_NO_CWCHAR -#include "boost_no_cwchar.ipp" -#else -namespace boost_no_cwchar = empty_boost; -#endif -#ifndef BOOST_NO_CWCTYPE -#include "boost_no_cwctype.ipp" -#else -namespace boost_no_cwctype = empty_boost; -#endif #ifndef BOOST_NO_DECLTYPE #include "boost_no_decltype.ipp" #else @@ -537,6 +537,11 @@ namespace boost_no_templated_iostreams = empty_boost; #else namespace boost_no_template_templates = empty_boost; #endif +#ifndef BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS +#include "boost_no_tem_local_classes.ipp" +#else +namespace boost_no_local_class_template_parameters = empty_boost; +#endif #ifndef BOOST_NO_TWO_PHASE_NAME_LOOKUP #include "boost_no_two_phase_lookup.ipp" #else @@ -1111,6 +1116,86 @@ int main( int, char *[] ) std::cerr << "Failed test for BOOST_HAS_WINTHREADS at: " << __FILE__ << ":" << __LINE__ << std::endl; ++error_count; } + if(0 != boost_no_adl_barrier::test()) + { + std::cerr << "Failed test for BOOST_NO_ADL_BARRIER at: " << __FILE__ << ":" << __LINE__ << std::endl; + ++error_count; + } + if(0 != boost_no_argument_dependent_lookup::test()) + { + std::cerr << "Failed test for BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP at: " << __FILE__ << ":" << __LINE__ << std::endl; + ++error_count; + } + if(0 != boost_no_array_type_specializations::test()) + { + std::cerr << "Failed test for BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS at: " << __FILE__ << ":" << __LINE__ << std::endl; + ++error_count; + } + if(0 != boost_no_auto_declarations::test()) + { + std::cerr << "Failed test for BOOST_NO_AUTO_DECLARATIONS at: " << __FILE__ << ":" << __LINE__ << std::endl; + ++error_count; + } + if(0 != boost_no_auto_multideclarations::test()) + { + std::cerr << "Failed test for BOOST_NO_AUTO_MULTIDECLARATIONS at: " << __FILE__ << ":" << __LINE__ << std::endl; + ++error_count; + } + if(0 != boost_no_auto_ptr::test()) + { + std::cerr << "Failed test for BOOST_NO_AUTO_PTR at: " << __FILE__ << ":" << __LINE__ << std::endl; + ++error_count; + } + if(0 != boost_bcb_partial_specialization_bug::test()) + { + std::cerr << "Failed test for BOOST_BCB_PARTIAL_SPECIALIZATION_BUG at: " << __FILE__ << ":" << __LINE__ << std::endl; + ++error_count; + } + if(0 != boost_no_char16_t::test()) + { + std::cerr << "Failed test for BOOST_NO_CHAR16_T at: " << __FILE__ << ":" << __LINE__ << std::endl; + ++error_count; + } + if(0 != boost_no_char32_t::test()) + { + std::cerr << "Failed test for BOOST_NO_CHAR32_T at: " << __FILE__ << ":" << __LINE__ << std::endl; + ++error_count; + } + if(0 != boost_no_complete_value_initialization::test()) + { + std::cerr << "Failed test for BOOST_NO_COMPLETE_VALUE_INITIALIZATION at: " << __FILE__ << ":" << __LINE__ << std::endl; + ++error_count; + } + if(0 != boost_no_constexpr::test()) + { + std::cerr << "Failed test for BOOST_NO_CONSTEXPR at: " << __FILE__ << ":" << __LINE__ << std::endl; + ++error_count; + } + if(0 != boost_no_ctype_functions::test()) + { + std::cerr << "Failed test for BOOST_NO_CTYPE_FUNCTIONS at: " << __FILE__ << ":" << __LINE__ << std::endl; + ++error_count; + } + if(0 != boost_no_cv_specializations::test()) + { + std::cerr << "Failed test for BOOST_NO_CV_SPECIALIZATIONS at: " << __FILE__ << ":" << __LINE__ << std::endl; + ++error_count; + } + if(0 != boost_no_cv_void_specializations::test()) + { + std::cerr << "Failed test for BOOST_NO_CV_VOID_SPECIALIZATIONS at: " << __FILE__ << ":" << __LINE__ << std::endl; + ++error_count; + } + if(0 != boost_no_cwchar::test()) + { + std::cerr << "Failed test for BOOST_NO_CWCHAR at: " << __FILE__ << ":" << __LINE__ << std::endl; + ++error_count; + } + if(0 != boost_no_cwctype::test()) + { + std::cerr << "Failed test for BOOST_NO_CWCTYPE at: " << __FILE__ << ":" << __LINE__ << std::endl; + ++error_count; + } if(0 != boost_no_cxx11_hdr_array::test()) { std::cerr << "Failed test for BOOST_NO_CXX11_HDR_ARRAY at: " << __FILE__ << ":" << __LINE__ << std::endl; @@ -1201,86 +1286,6 @@ int main( int, char *[] ) std::cerr << "Failed test for BOOST_NO_CXX11_HDR_UNORDERED_SET at: " << __FILE__ << ":" << __LINE__ << std::endl; ++error_count; } - if(0 != boost_no_adl_barrier::test()) - { - std::cerr << "Failed test for BOOST_NO_ADL_BARRIER at: " << __FILE__ << ":" << __LINE__ << std::endl; - ++error_count; - } - if(0 != boost_no_argument_dependent_lookup::test()) - { - std::cerr << "Failed test for BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP at: " << __FILE__ << ":" << __LINE__ << std::endl; - ++error_count; - } - if(0 != boost_no_array_type_specializations::test()) - { - std::cerr << "Failed test for BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS at: " << __FILE__ << ":" << __LINE__ << std::endl; - ++error_count; - } - if(0 != boost_no_auto_declarations::test()) - { - std::cerr << "Failed test for BOOST_NO_AUTO_DECLARATIONS at: " << __FILE__ << ":" << __LINE__ << std::endl; - ++error_count; - } - if(0 != boost_no_auto_multideclarations::test()) - { - std::cerr << "Failed test for BOOST_NO_AUTO_MULTIDECLARATIONS at: " << __FILE__ << ":" << __LINE__ << std::endl; - ++error_count; - } - if(0 != boost_no_auto_ptr::test()) - { - std::cerr << "Failed test for BOOST_NO_AUTO_PTR at: " << __FILE__ << ":" << __LINE__ << std::endl; - ++error_count; - } - if(0 != boost_bcb_partial_specialization_bug::test()) - { - std::cerr << "Failed test for BOOST_BCB_PARTIAL_SPECIALIZATION_BUG at: " << __FILE__ << ":" << __LINE__ << std::endl; - ++error_count; - } - if(0 != boost_no_char16_t::test()) - { - std::cerr << "Failed test for BOOST_NO_CHAR16_T at: " << __FILE__ << ":" << __LINE__ << std::endl; - ++error_count; - } - if(0 != boost_no_char32_t::test()) - { - std::cerr << "Failed test for BOOST_NO_CHAR32_T at: " << __FILE__ << ":" << __LINE__ << std::endl; - ++error_count; - } - if(0 != boost_no_complete_value_initialization::test()) - { - std::cerr << "Failed test for BOOST_NO_COMPLETE_VALUE_INITIALIZATION at: " << __FILE__ << ":" << __LINE__ << std::endl; - ++error_count; - } - if(0 != boost_no_constexpr::test()) - { - std::cerr << "Failed test for BOOST_NO_CONSTEXPR at: " << __FILE__ << ":" << __LINE__ << std::endl; - ++error_count; - } - if(0 != boost_no_ctype_functions::test()) - { - std::cerr << "Failed test for BOOST_NO_CTYPE_FUNCTIONS at: " << __FILE__ << ":" << __LINE__ << std::endl; - ++error_count; - } - if(0 != boost_no_cv_specializations::test()) - { - std::cerr << "Failed test for BOOST_NO_CV_SPECIALIZATIONS at: " << __FILE__ << ":" << __LINE__ << std::endl; - ++error_count; - } - if(0 != boost_no_cv_void_specializations::test()) - { - std::cerr << "Failed test for BOOST_NO_CV_VOID_SPECIALIZATIONS at: " << __FILE__ << ":" << __LINE__ << std::endl; - ++error_count; - } - if(0 != boost_no_cwchar::test()) - { - std::cerr << "Failed test for BOOST_NO_CWCHAR at: " << __FILE__ << ":" << __LINE__ << std::endl; - ++error_count; - } - if(0 != boost_no_cwctype::test()) - { - std::cerr << "Failed test for BOOST_NO_CWCTYPE at: " << __FILE__ << ":" << __LINE__ << std::endl; - ++error_count; - } if(0 != boost_no_decltype::test()) { std::cerr << "Failed test for BOOST_NO_DECLTYPE at: " << __FILE__ << ":" << __LINE__ << std::endl; @@ -1626,6 +1631,11 @@ int main( int, char *[] ) std::cerr << "Failed test for BOOST_NO_TEMPLATE_TEMPLATES at: " << __FILE__ << ":" << __LINE__ << std::endl; ++error_count; } + if(0 != boost_no_local_class_template_parameters::test()) + { + std::cerr << "Failed test for BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS at: " << __FILE__ << ":" << __LINE__ << std::endl; + ++error_count; + } if(0 != boost_no_two_phase_name_lookup::test()) { std::cerr << "Failed test for BOOST_NO_TWO_PHASE_NAME_LOOKUP at: " << __FILE__ << ":" << __LINE__ << std::endl; diff --git a/test/no_tem_local_classes_fail.cpp b/test/no_tem_local_classes_fail.cpp new file mode 100644 index 00000000..7f24b6ec --- /dev/null +++ b/test/no_tem_local_classes_fail.cpp @@ -0,0 +1,37 @@ +// This file was automatically generated on Wed Mar 21 13:05:19 2012 +// 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_LOCAL_CLASS_TEMPLATE_PARAMETERS +// This file should not compile, if it does then +// BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS should not be defined. +// See file boost_no_tem_local_classes.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 +#include "test.hpp" + +#ifdef BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS +#include "boost_no_tem_local_classes.ipp" +#else +#error "this file should not compile" +#endif + +int main( int, char *[] ) +{ + return boost_no_local_class_template_parameters::test(); +} + diff --git a/test/no_tem_local_classes_pass.cpp b/test/no_tem_local_classes_pass.cpp new file mode 100644 index 00000000..1dcbf59d --- /dev/null +++ b/test/no_tem_local_classes_pass.cpp @@ -0,0 +1,37 @@ +// This file was automatically generated on Wed Mar 21 13:05:19 2012 +// 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_LOCAL_CLASS_TEMPLATE_PARAMETERS +// This file should compile, if it does not then +// BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS should be defined. +// See file boost_no_tem_local_classes.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 +#include "test.hpp" + +#ifndef BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS +#include "boost_no_tem_local_classes.ipp" +#else +namespace boost_no_local_class_template_parameters = empty_boost; +#endif + +int main( int, char *[] ) +{ + return boost_no_local_class_template_parameters::test(); +} +