Re: [pygccxml-development] problem with private classes
Brought to you by:
mbaas,
roman_yakovenko
|
From: Roman Y. <rom...@gm...> - 2008-07-08 04:55:39
|
On Tue, Jul 8, 2008 at 5:03 AM, Gordon Wrigley <gor...@gm...> wrote:
> I think I found another bug, but I'm not sure who's bug it is. This:
>
> class Alpha
> {
> private:
> class Omega
> {
> <snip>
> }
>
> public:
> Omega *pOmega;
> }
>
> produces:
>
> static ::Alpha::Omega * get_pOmega(Alpha const & inst ){
> return inst.pOmega;
> }
>
> which leads to:
>
> extending.cpp(634) : error C2248: 'Alpha::Omega' : cannot access private
> class declared in class 'Alpha'
> c:\program
> files\boost\boost_1_35_0\libs\python\example\bobit.h(1458) : see declaration
> of 'Alpha::Omega'
> c:\program
> files\boost\boost_1_35_0\libs\python\example\bobit.h(1223) : see declaration
> of 'Alpha'
The example you posted could not be compiled with gccxml: The error is:
Error occured during code generation process!
Error:
Error occured while running GCC-XML: d:\tmp\yyy.h: In function
'Alpha::Omega* get_pOmega(const Alpha&)':
d:\tmp\yyy.h:5: error: 'class Alpha::Omega' is private
d:\tmp\yyy.h:11: error: within this context
I guess the actual code looks like:
class Alpha
{
private:
class Omega
{};
public:
typedef Omega Om;
public:
Omega *pOmega;
};
static ::Alpha::Om * get_pOmega(Alpha const & inst ){
return inst.pOmega;
}
Now these are the warning I've got during the code generation process:
> warning W1025: Py++ will generate class wrapper - class contains
> "pOmega" - T* member variable
WARNING: Alpha::Omega * get_pOmega(Alpha const & inst) [free function]
> compilation error W1005: Py++ cannot expose function that takes as
> argument/returns instance of non-public class. Generated code will not
> compile.
WARNING: Alpha::Omega * get_pOmega(Alpha const & inst) [free function]
> compilation error W1050: The function returns "Alpha::Omega *" type.
> You have to specify a call policies.Be sure to take a look on Py++
> defined call policies: http://language-
> binding.net/pyplusplus/documentation/functions/call_policies.html#py-
> defined-call-policies
WARNING: Alpha::Omega [class]
> execution error W1040: The declaration is unexposed, but there are
> other declarations, which refer to it. This could cause "no to_python
> converter found" run time error. Declarations: Alpha::pOmega
> [variable]
The last warning warns you about that. Now you can decide what you
want to do. In my opinion this is just a mistake in the code, but I
could be wrong.
Anyway if you want to exclude declarations, based on warnings they
produce, you can do this too:
http://language-binding.net/pyplusplus/documentation/warnings.html
HTH
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
|