[C++-sig] Re: Attempted a typeid of NULL pointer!

David Abrahams dave at boost-consulting.com
Sat May 31 18:29:33 CEST 2003


"Baptiste Lepilleur" <gaiacrtn at free.fr> writes:

> I've run into the same issue yesterday. I'm using boost 1.30 with MSVC 6.
>
> This problem arise when trying to obtain a default constructed shared_ptr in
> python. It seems that the conversion of a null shared_ptr to None is not
> handled. Though, I don't know if this feature is supported (the unit-test
> for shared_ptr is too complicated for me to understand).
>
>
> Here is the python code. It only fail when 'statement.elseStatement' is a
> NULL shared_ptr.
>     def visitIfStatement( self, statement ):
>         self._visitScopedSubstatement( statement.thenStatement )
>
>         if statement.elseStatement:        # C++ property which is a
> shared_ptr
>             self._visitScopedSubstatement( statement.elseStatement )
> ---
>   File "C:\prg\vc\Rfta\src\pyrfta\test\rfta\codeanalysis.py", line 39, in
> visitIfStatement
>     if statement.elseStatement:
> RuntimeError: Attempted a typeid of NULL pointer!
> ---
>
> Notes that using explicit comparison against None also fail:
>         if None != statement.elseStatement:

OK, I'm working on a fix.  I'll let you know when it's done.  Thanks
for the bug reports.

[By the way...  This is no way to report such a simple bug as simple
as this one.  In order to use your code I have to fill in lots of
missing details, like the definition of ConditionStatement, so I
didn't use the code at all.  It's not much better than the previous
post which gave no information about how to reproduce the problem.]

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list