I found the construct
using A = struct A{};
in a C++ code base. What is this good for? My guess would be that using A has no effect at all in this context.
>Solution :
As for why it’s valid C++, I would imagine that is due to parity with typedef. Many a C code base have something like this:
typedef struct A {
// ...
} A;
This is valid C, and for compatibility’s sake, the C++ standard has verbiage to accept this construct (which has no effect). Since a type alias declaration with using is meant to be exactly the same as the equivalent typedef, the validity of what you saw is likely an emergent property.
As for why you saw it, it may just be a C-ism (which often make their way into C++ code) that got translated into "Modern C++". That is of course silly, and a simple structure declaration will do if the code is meant to be C++-only1.
1 – The C standard did add a bunch of features in C23 for increased parity with C++ code. I’m not aware of any plans to allow modern C++ type aliases in C, but assuming there were any, that construct may then be used for compatibility too.