diff --git a/SConstruct b/SConstruct index 39ec9f096..820cd24f1 100644 --- a/SConstruct +++ b/SConstruct @@ -707,6 +707,22 @@ struct B:A {{ if not macro_value: raise SCons.Errors.StopError("C++ compiler does not support constructor forwarding.") context.sconf.Define(macro_name + macro_parameters, macro_value) + @_custom_test + def check_cxx11_template_alias(self,context): + text = ''' +template +struct A; +template +using B = A; +int main(int, char **){ + A *a = 0; + B *b = a; + (void)b; + return 0; +} +''' + if self.Cxx11Compile(context, text=text, msg='for C++11 template aliases'): + context.sconf.Define('DXX_HAVE_CXX11_TEMPLATE_ALIAS') class LazyObjectConstructor: def __lazy_objects(self,name,source): diff --git a/common/include/compiler-integer_sequence.h b/common/include/compiler-integer_sequence.h index d237b6082..3f8dc0fa9 100644 --- a/common/include/compiler-integer_sequence.h +++ b/common/include/compiler-integer_sequence.h @@ -38,8 +38,13 @@ struct tree_index_sequence<1> typedef index_sequence<0> type; }; +#ifdef DXX_HAVE_CXX11_TEMPLATE_ALIAS +template +using make_tree_index_sequence = typename tree_index_sequence::type; +#else template static inline constexpr typename tree_index_sequence::type make_tree_index_sequence() { return {}; } +#endif