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