编译器错误 C3732

“interface”:触发 COM 事件的自定义接口不能从 IDispatch 继承

支持 COM 事件的接口不能从 IDispatch 继承。 有关详细信息,请参阅 COM 中的事件处理

以下错误生成 C3732:

// C3732.cpp
#define _ATL_ATTRIBUTES 1
#include "atlbase.h"
#include "atlcom.h"

[module(name="test")];

// to resolve this C3732, use dual instead of object
// or inherit from IUnknown
[ object ]
__interface I : IDispatch
{
};

[ event_source(com), coclass ]
struct A
{
   __event __interface I;   // C3732
};

int main()
{
}