C1001在msc1.cpp:2701时专门化模板成员 [英] C1001 at msc1.cpp:2701 when specializing template member
问题描述
VC 7.1.3088错误:当一个类定义一个模板成员函数(T const&),
然后一个显式的特化,取一个非const&参数(U)在msc1.cpp第2701行导致C1001。
以下短程序重复此错误。
在调试模式下编译它(所有优化)禁用),不使用预编译的头文件。
C类将F定义为模板成员函数(_T const&)。
它然后专攻F取一个字符。
a)如果专业化签名是(char const&),它编译好。
b)如果专业化签名是(char)或(char&),它以C1001失败。
VC6和VC7.0编译(b)没有任何问题。
VC 7.1.3088 Bug: When a class defines a template member function taking (T const &),
then an explicit specialization taking a non-const & argument (U) causes a C1001 at msc1.cpp line 2701.
The following short program duplicates this error.
Compile it in Debug mode (all optimizations disabled), with "Not using precompiled headers".
Class C defines F as a template member function taking (_T const &).
It then specializes F taking a char.
a) If the specialization signature is (char const &), it compiles OK.
b) If the specialization signature is (char) or (char &), it fails with a C1001.
VC6 and VC7.0 compile (b) without any problems.
推荐答案
Eric Wang写道:
Eric Wang wrote:
VC 7.1.3088错误:当一个类定义模板成员函数时,取(T const&),
然后一个明确的专业化采取非const&参数(U)
在msc1.cpp第2701行导致C1001。
以下简短程序重复此错误。
VC 7.1.3088 Bug: When a class defines a template member function
taking (T const &),
then an explicit specialization taking a non-const & argument (U)
causes a C1001 at msc1.cpp line 2701.
The following short program duplicates this error.
您打算加入短程序吗?
-cd
Did you intend to include the short program?
-cd
>你打算加入短节目吗?
非常令人沮丧。
我试过发布我的节目8次。服务器每次都会出错。
我将我的程序从10行缩短到8行,缩短为6到5.错误,错误,错误。
我把它缩短为1行。这很有用。
服务器每个帖子只接受1行C ++代码吗?
是否会出现大括号,分号或其他C ++字符?
> Did you intend to include the short program?
Very damn frustrating.
I''ve tried posting my program 8 times. The server gives an error every time.
I shorten my program from 10 lines to 8, to 6, to 5. Error, error, error.
I shortened it to 1 line. That worked.
Does the server accept only 1 line of C++ code per post?
Does it choke on curly brace, semicolon, or other C++ characters?
C类{public:
class C { public:
这篇关于C1001在msc1.cpp:2701时专门化模板成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!