2

这是一个简化的测试用例:

template <typename Sig, Sig& S> struct OpF;

template <typename TR, typename ... Ts, TR (&f)(Ts...)>
struct OpF<TR (Ts...), f> {};

double foo() { return 0; }

struct RegFun {
  template <typename R, typename ... Ps> RegFun(R (*)(Ps...)) {
    typedef OpF<R (Ps...), foo> OP;
    OP();
  }
} FNRegisterer(foo);

编译器说:

ice2013_4.cpp(11) : fatal error C1001: An internal error has occurred in the compiler.
(compiler file 'f:\dd\vctools\compiler\cxxfe\sl\p1\c\template.cpp', line 22679)
 To work around this problem, try simplifying or changing the program near the locations listed above.
Please choose the Technical Support command on the Visual C++
 Help menu, or open the Technical Support help file for more information
    ice2013_4.cpp(11) : see reference to class template instantiation 'OpF<R (void),double foo(void)>' being compiled
    with
    [
    R=double
    ]
    ice2013_4.cpp(13) : see reference to function template instantiation 'Re gFun::RegFun<double,>(R (__cdecl *)(void))' being compiled
    with
    [
    R=double
    ]

“尝试在上面列出的位置附近简化或更改程序”建议对我来说看起来很有趣,但也许有人可以想到一个不会扰乱编译器的修改。

4

0 回答 0