Anonymous union issues:
A name in the following code is mangled incorrectly:
inline int f1 () { static union { int a; long int b; }; static union { int c; double d; }; return a+c; } int f2 (int a) { return a+f1(); }
The name of the second union is mangled as _ZZ2f1vE1c_0 instead of _ZZ2f1vE1c. According to the Itanium C++ ABI '5.1.6 Scope Encoding':
The discriminator is used only for the second and later occurrences of the same "top-level" name within a single function (since "unnamed types" are distinctly numbered, they never include a discriminator).
In the program above 'int c' is the first occurrence of the name 'c'. So no discriminator must be used.