Diagnose including compiler-type_traits without dxxsconf.h

This commit is contained in:
Kp 2015-07-25 23:10:45 +00:00
parent 8594086b23
commit cdb113a050
2 changed files with 7 additions and 0 deletions

View file

@ -805,12 +805,15 @@ help:assume <type_traits> works
@_custom_test
def _check_type_traits(self,context):
f = '''
#define DXX_INHERIT_CONSTRUCTORS /* bypass sanity check */
#include "compiler-type_traits.h"
typedef tt::conditional<true,int,long>::type a;
typedef tt::conditional<false,int,long>::type b;
'''
if self.check_cxx11_type_traits(context, f) or self.check_boost_type_traits(context, f):
context.sconf.Define('DXX_HAVE_TYPE_TRAITS')
return
raise SCons.Errors.StopError("C++ compiler does not support <type_traits> or Boost.TypeTraits.")
@_implicit_test
def check_boost_foreach(self,context,**kwargs):
"""

View file

@ -6,6 +6,7 @@
*/
#pragma once
#ifdef DXX_INHERIT_CONSTRUCTORS
#if defined(DXX_HAVE_CXX11_TYPE_TRAITS)
#include <type_traits>
namespace tt = std;
@ -15,3 +16,6 @@ namespace tt = boost;
#else
#error "No <type_traits> implementation found."
#endif
#else
#error "\"compiler-type_traits.h\" included before \"dxxsconf.h\""
#endif