Article ID: 168009
Article Last Modified on 10/24/2003
170365 INFO: Visual Studio 97 Service Packs - What, Where, and Why
// Compile option needed /W4
class A
{ A();
};
struct B
{ __declspec( property (get=getA)) A a;
A getA();
};
void f()
{
B b;
}
The second sample generates the following errors:
// custom.idl
// MIDL options: <none>
#include <olectl.h>
#include <idispids.h>
#ifndef DO_NO_IMPORTS
import "objidl.idl";
import "oleidl.idl";
import "oaidl.idl";
import "ocidl.idl";
#endif
interface IB;
[ object, uuid(27979FD1-E576-11cf-BFAC-00A02437A6A0) ]
interface IA : IUnknown
{
[propput, id(1)] HRESULT Interface([in] IB* pB);
[propget, id(1)] HRESULT Interface([out, retval] IB** ppB);
}
[ object, uuid(27979FD0-E576-11cf-BFAC-00A02437A6A0) ]
interface IB : IUnknown
{
[id(5)] HRESULT Method([in] int in1);
}
[ uuid(596DBF82-2F2D-11D0-A537-00A02437A6A0), version(1.0) ]
library Custom
{
importlib(STDOLE_TLB);
importlib(STDTYPE_TLB);
interface IA;
interface IB;
}
// test.cpp
// compile options: /GX /W4 /c
#import "Custom.tlb" no_namespace
class CA : IA
{
STDMETHOD_(ULONG, AddRef)() { return 0; }
STDMETHOD_(ULONG, Release)() { return 0; }
STDMETHOD(QueryInterface)(REFIID, LPVOID* ) { return E_NOTIMPL; }
// ICustom methods
STDMETHOD(put_Interface)(IB *) { return E_NOTIMPL; }
STDMETHOD(get_Interface)(IB **) { return E_NOTIMPL; }
};
class CB
{
CB(){
CA* pA = new CA;
if (pA)
delete pA;
}
};
Keywords: kbbug kbfix kbvs97sp1fix kbvs97sp2fix KB168009