编译器错误 C3373
除了针对组件类,特性“attribute”不接受任何参数
某些特性可以应用于多个 C++ 构造,但特性的参数只允许在某些构造上使用。
下面的示例生成 C3373:
// C3373.cpp
#include <windows.h>
[module(name="MyModule")];
[ object, uuid(373a1a4c-469b-11d3-a6b0-00c04f79ae8f) ]
__interface IMyIface
{
// arguments to source and restricted are not allowed when
// these attributes are applied to an interface
[source(IMyIface)] HRESULT f1();
[restricted(IMyIface)] HRESULT f2(); // C3373
};
[ coclass, uuid(373a1a4d-469b-11d3-a6b0-00c04f79ae8f) ]
class CMyClass : public IMyIface {
};
int main() {
}
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈