Apparent aliasing problem when optimizing
Marc Singer
elf@buici.com
Thu Apr 10 06:16:00 GMT 2003
On Wed, Apr 09, 2003 at 10:50:59PM -0700, Zack Weinberg wrote:
> Change
>
> HRESULT result =
> m_psfDesktop->BindToObject (pidl, __null, IID_IShellFolder, &(void*)psf);
>
> to
>
> HRESULT result =
> m_psfDesktop->BindToObject (pidl, __null, IID_IShellFolder, (PVOID*)&psf);
>
> and it should start working correctly. (Your code should get a
> warning, or perhaps even a hard error - you're applying the & operator
> to a cast to non-reference type, which is not an lvalue, so it's
> invalid.)
>
> I see several other places where the code contains the same mistake.
When compiling with -Wall there are no warning. I read your
explanation. Why (void*) cannot be a reference type when
(IShellFolder*) is?
More information about the Gcc-bugs
mailing list