ICE(内部编译器错误)在 vcxproj 从 vs2013 更新到 vs2015 之后

ICE (Internal compiler error) after vcxproj update from vs2013 to vs2015

"similar questions"不涉及我的情况。

从 VS2013 (v120) 切换到 VS2015(v140) 后结果是:

1>------ Build started: Project: my_project, Configuration: Debug Win32 ------
1>  aSource.cpp
1>d:\my_project\aHeader.h(61): warning C4114: same type qualifier used more than once
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\array(215): warning C4346: 'std::_Is_nothrow_swappable<_Ty>::value': dependent name is not a type
1>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\array(215): note: prefix with 'typename' to indicate a type
1>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\array(221): note: see reference to class template instantiation 'std::array<_Ty,_Size>' being compiled
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\array(215): error C2061: syntax error: identifier 'value'
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\array(216): error C2091: function returns function
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\array(435): error C2988: unrecognizable template declaration/definition
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\array(435): error C2059: syntax error: ')'
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\array(442): error C2065: '_Ty': undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\array(442): error C2065: '_Size': undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\array(442): error C2923: 'std::array': '_Ty' is not a valid template type argument for parameter '_Ty'
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\array(442): error C2975: '_Size': invalid template argument for 'std::array', expected compile-time constant expression
1>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\array(20): note: see declaration of '_Size'
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\array(443): error C2065: '_Ty': undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\array(443): error C2065: '_Size': undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\array(443): error C2923: 'std::array': '_Ty' is not a valid template type argument for parameter '_Ty'
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\array(443): error C2975: '_Size': invalid template argument for 'std::array', expected compile-time constant expression
1>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\array(20): note: see declaration of '_Size'
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\array(444): error C2143: syntax error: missing ';' before '{'
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\array(444): error C2447: '{': missing function header (old-style formal list?)
1>  INTERNAL COMPILER ERROR in 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\CL.exe'
1>      Please choose the Technical Support command on the Visual C++
1>      Help menu, or open the Technical Support help file for more information
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

备注:

编辑: aHeader.h

的内容
#ifndef AINTERFACE_H
#define AINTERFACE_H 1

typedef int result;

#define IRESULT         result
#define IFUNCTION       virtual IRESULT
#define IIN(X)          X const&
#define IOUT(X)         X&
#define FUNCSPEC_IFACE  noexcept = 0
#define FUNCSPEC_IMPL   noexcept
#define ISUCCESS        0

class aInterface {
public:

    aInterface(IIN(char const* const) name)
        : iface_name_(name) {}

    IFUNCTION iface_name(IOUT(char const*) target)  FUNCSPEC_IFACE;

protected:

    char const*const    iface_name_;
};

#define IFACE_FUNCTIONS_DEFAULT                                         \
            IFUNCTION iface_name(IOUT(char const*) target) FUNCSPEC_IMPL\
                { target = aInterface::iface_name_; return ISUCCESS; }

#define IFACE_DEFAULT(NAME)                                         \
                    IFACE_FUNCTIONS_DEFAULT                         \
                    public: NAME() : aInterface(str(NAME))


#endif

Afaik 这是实现 CRTP 的基本接口

旁注:

#define str_hlp(arg) #arg
#define strnz(arg) str_hlp(arg)
#define strz(arg) str_hlp(arg) "[=12=]"
#define str(arg) strz(arg)

谢谢

在项目初始开发期间。 VS2015 仍未完成,VS2013 确实(仍然)不完全支持 c++11 标准。

出于兼容性原因,在一个有点隐蔽的角落进行了破解。

#if defined( _MSC_VER )/* && (_MSC_VER < insert here version which will support)*/

#  define noexcept  throw()
#  define constexpr const inline

#endif

我们现在决定将其更改为

#if defined( _MSC_VER ) && (_MSC_VER < 1910)

#  define noexcept  throw()
#  define constexpr const inline

#endif

并跳过 VS2015。

非常感谢