Making private types public


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.


Volker Weißmann

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

    class c {

        class no_longer_priv{};