Iñaki Ucar writes:
On Sun, 9 Feb 2020 at 14:20, Sam Varshavchik <mrsam@xxxxxxxxxxxxxxx> wrote: > > Iñaki Ucar writes: > > > Thoughts? > > > > [1] https://gist.github.com/kevinushey/cfa848be2d39ddd110f893d9b6c5ac9c > > I managed to find the part of the C++ standard that specified the semantics> of extern "C" linkage, it is [dcl.link]. The term used is "language linkage".> > There is no such thing as an inline function in C. That code compiles C++ > code with C language linkage. > > Reading the C++ standard,, all that the standard seems to specify is > language linkage of declarations. Quoting: >> # Every implementation shall provide for linkage to functions written in the C> # programming language, "C", and linkage to C ++ functions, "C++". > # > # [ Example: > # complex sqrt(complex); > # // C++ linkage by default > # extern "C" { > # double sqrt(double); > # // C linkage > # } > # — end example ] > > The standard does not seem to specify the definitions of functions inside > a language linkage specification. Either that is unspecified and therefore > is a compiler extension; or it is clear that the only thing that belongs > inside extern "C" is C code, and there's no such thing as inline functions > in C, so declaring C++ code with C linkage would also be considered a > compiler extension. > > This code compiles in gcc 9, but not in gcc 10. That's life, for compiler > extensions. So, summing up, nothing wrong with that code according to the standard. Therefore, since this is a regression that breaks previous behaviour, I'd say this is a bug in gcc, right?
No, exactly the opposite. As I wrote:
> Reading the C++ standard,, all that the standard seems to specify is > language linkage of declarations.
The code that fails to compile is not a declaration. It defines an inline C++ function. I find nothing in C++ standard that specifies function definitions inside linkage specifications.
This is a declaration: void foo(); This is a definition: void bar() { }
Attachment:
pgpsU_TcbdZcf.pgp
Description: PGP signature
_______________________________________________ devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx