[cfe-users] Making private types public

2021-01-03 Thread Volker Weißmann via cfe-users

Hello,

If you define a type privately (or protected) like this:

class c {

    class priv{};

};

then the writing "c::priv" outside of the class c will generate the 
error "'class c::priv' is private within this context". This is really 
bad for me, because I'm currently writing a tool that generates Rust-C++ 
wrappers. I'm thinking of writing a PR, that would add a command line 
option to clang that would make clang treat all type definitions as if 
there would be a "public:" in front of them. I'm asking if anyone wants 
to tell me that this is a bad idea or wants to give me advice.




Greetings

Volker Weißmann

___
cfe-users mailing list
cfe-users@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users


Re: [cfe-users] Making private types public

2021-01-03 Thread Matthew Fernandez via cfe-users

> On Jan 3, 2021, at 16:12, Volker Weißmann via cfe-users 
>  wrote:
> 
> Hello,
> 
> If you define a type privately (or protected) like this:
> 
> class c {
> 
> class priv{};
> 
> };
> 
> then the writing "c::priv" outside of the class c will generate the error 
> "'class c::priv' is private within this context". This is really bad for me, 
> because I'm currently writing a tool that generates Rust-C++ wrappers. I'm 
> thinking of writing a PR, that would add a command line option to clang that 
> would make clang treat all type definitions as if there would be a "public:" 
> in front of them. I'm asking if anyone wants to tell me that this is a bad 
> idea or wants to give me advice.

Maybe I misunderstand your use case, but if you’re generating the C++ why not 
just generate the inner type as accessible?

class c {

  public:
class no_longer_priv{};
};
___
cfe-users mailing list
cfe-users@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users