无效的整型常量表达式

The*_* do -1 c++ visual-studio-2010

在这段代码中:

// CompileTimeWarnings.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <type_traits>
using namespace std;
#define __STR1__(x) #x

#define __LOC__ __FILE__ "("__STR1__(__LINE__)") : warning : "

// collisions.cpp

template<class T, class T1>
struct mismatch
{
    //enum {value = is_signed<T>::value && is_signed<T1>::value};
    static const bool value; //= is_signed<T>::value && is_signed<T1>::value;
};

template<class T, class T1>
bool mismatch<T,T1>::value = is_signed<T>::value && is_signed<T1>::value;

template<class T>
struct Int
{
};

template<class T, class T1>
int operator+(Int<T> t, Int<T1> t1)
{
#if int(mismatch<T,T1>::value)
#pragma message(__LOC__"Need to do 3D collision testing")
#endif
    return 0;
}

int _tmain(int argc, _TCHAR* argv[])
{
Int<int> a;
Int<signed> b;
b + a;
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我正在关注错误信息:
C1017:无效的整数常量表达式.
为什么?以及如何解决?

编辑

#include "stdafx.h"
#include <type_traits>
#include <iostream>

using namespace std;

template<class T>
struct Int
{
};

template<class T, class T1>
struct Mismatch
{
    static const bool value = (!is_signed<T>::value && is_signed<T1>::value) || 
                                (is_signed<T>::value && !is_signed<T1>::value);
};



template<bool b> struct Need_to_do_3D_collision_testing
{ 
    static void f()
    { static const char value=256; }
};

template<> struct Need_to_do_3D_collision_testing<true>
{
    static void f() { } 
};

template<class T, class T1> int operator+(Int<T> t, Int<T1> t1) 
{
Need_to_do_3D_collision_testing<!Mismatch<T,T1>::value>::f();
return 0;
} 






int _tmain(int argc, _TCHAR* argv[])
{
    Int<char> a;
    Int<unsigned char> b;
    b + a;
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我收到以下警告:
警告1警告C4305:'初始化':从'int'截断到'const char'
警告2警告C4309:'initializing':截断常量值
但不是带结构名称的警告.所以它对我来说并不适用.
Edit_2 警告级别/墙 - 最高
警告1警告C4820:'_ wfinddata64i32_t':在数据成员'_wfinddata64i32_t :: attrib'后添加'4'字节填充
警告2警告C4820:'_ wfinddata64i32_t':'数据成员后添加'4'字节填充' _wfinddata64i32_t :: name'
警告3警告C4820:'_ wfinddata64_t':在数据成员'_wfinddata64_t :: attrib'之后添加'4'字节填充
警告4警告C4820:'_ stat32':在数据成员'_stat32之后添加'2'字节填充: :st_gid'
警告5警告C4820:'stat':在数据成员'stat :: st_gid'之后添加'2'字节填充
警告6警告C4820:'_ stat32i64':在数据成员'_stat32i64 :: st_gid之后添加'2'字节填充'
警告7警告C4820:'_ stat32i64':在数据成员'_stat32i64 :: st_rdev'之后添加'4'字节填充警告8警告C4820:'_ stat32i64':在数据成员'_stat32i64 :: st_ctime'之后添加'4'字节填充
警告9警告C4820:'_ stat64i32':在数据成员'_stat64i32 :: st_gid'之后添加'2'字节填充
警告10警告 g C4820:'_ stat64':在数据成员'_stat64 :: st_gid'之后添加'2'字节填充
警告11警告C4820:'_ stat64':在数据成员'_stat64 :: st_rdev'之后添加'4'字节填充警告12警告C4986 :'operator new []':异常规范与先前的声明不匹配
警告13警告C4986:'operator delete []':异常规范与先前的声明不匹配
警告14警告C4820:'type_info':'3'字节填充后添加数据成员'type_info :: _ M_d_name'警告15警告C4305:'初始化':从'int'截断到'const char'警告16警告C4309:'初始化':截断常量值
警告17警告C4710:'std :: _ Exception_ptr std :: _ Exception_ptr :: _ Current_exception(void)':函数未内联
警告18警告C4710:'std :: string std :: locale :: name(void)const':函数未内联
警告19警告C4710:'std :: locale std :: ios_base :: getloc(void)const':函数未内联
警告20警告C4710:'std :: string std :: numpunct <_Elem> :: do_grouping(void)const':函数未内联
警告21警告C4710:'std :: basic_string <_Elem,_Traits,_Ax> std :: numpunct <_Elem> :: do_falsename(void)const':function未内联
警告22警告C4710:'std :: basic_string <_Elem,_ Traits,_Ax> std :: numpunct <_Elem> :: do_truename(void)const':函数未内联
警告23警告C4710:'std :: string std: :numpunct <_Elem> :: do_grouping(void)const':函数未内联
警告24警告C4710:'std :: basic_string <_Elem,_Traits,_Ax> std :: numpunct <_Elem> :: do_falsename(void)const':函数未内联
警告25警告C4710:'std :: basic_string <_Elem,_ Traits,_Ax> std :: numpunct <_Elem> :: do_truename(void)const':函数未内联
警告26警告C4710:'std :: basic_string < _Elem,_ Traits,_Ax> std :: numpunct <_Elem> :: falsename(void)const':函数未内联
警告27警告C4710:'std :: basic_string <_Elem,_Traits,_Ax> std :: numpunct <_Elem>: :truename(void)const':函数未内联
警告28警告C4710:'std :: basic_string <_Elem,_ Traits,_Ax> std :: numpunct <_Elem> :: falsename(void)const':函数未内联
警告29警告C4710:'std :: basic_string <_Elem,_Traits,_Ax> std: :numpunct <_Elem> :: truename(void)const':函数未内联
警告30警告C4710:'std :: string std :: numpunct <_Elem> :: grouping(void)const':函数未内联
警告31警告C4710 :'std :: string std :: numpunct <_Elem> :: grouping(void)const':函数未内联

Jam*_*lis 6

#if int(mismatch<T,T1>::value) 
Run Code Online (Sandbox Code Playgroud)

在解析源之前评估预处理指令.在这个#if指令中,编译器不知道它mismatch<T,T1>::value是什么.