https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121563
Harald van Dijk <harald at gigawatt dot nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |harald at gigawatt dot nl --- Comment #5 from Harald van Dijk <harald at gigawatt dot nl> --- (In reply to Alejandro Colomar from comment #2) > (In reply to Jakub Jelinek from comment #1) > > I don't see any inconsistency or problem. > > In the f1 case, you are forward declaring the same parameter twice (no > > problem) and then declaring it. > > In the f2 case, you are declaring y, then forward declaring another y and > > declaring another y. That is the same error as if you do void f2a (int y, > > int y);. > > I don't think so. According to GCC's documentation, everything up-to the > last ';' is a forward declaration. Agreed, void f2a(int y, int y) provides two definitions of y, and more than one definition does need to be diagnosed. That modified example is too different to expect it to work the same. A closer analogy would be something else where two forward declarations are provided for the same name in the same declaration. For instance, in global scope, "int x, x;" is perfectly fine. So is "void foo(), foo();".