C++ - Forward declaration and alias (with using or typedef)

  1. It does not work because the forward declaration struct mutex; tells the compiler that mutex is a new type. With using you are then creating a type alias, which means it's not a new type (as promised to the compiler), but an alias to an existing type.

  2. No.

  3. Yes.


What you could do is:

struct mutex : ParticularMutex {
    using ParticularMutex::ParticularMutex; // inherit constructors
};

Which does define a type derived from ParticularMutex which is hopefully compatible enough. Of course, this is a new type which might lead to other problems.