https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89937
--- Comment #2 from Walt Karas <wkaras at yahoo dot com> --- (In reply to Andrew Pinski from comment #1) > This is because of the way inline have different semantics between the two > langauges. > > If I change TSFastDbg to be static instead of just inline, then the code > emitted is the same. > In the case of C, since TSFastDbg is not inlined, there exists an out of > line version of it in a different TU. > In the case of C++, TSFastDbg has vague linkage, there for will be emitted > but in a comdat section. > > The options you have turned on for godbolt, hide this fact; turning them off > you get: > > .Ltext0: > .section > .text._Z9TSFastDbgP14TSFastDbgCntl_PKcz,"axG",@progbits, > _Z9TSFastDbgP14TSFastDbgCntl_PKcz,comdat > .p2align 4,,15 > .weak _Z9TSFastDbgP14TSFastDbgCntl_PKcz > .type _Z9TSFastDbgP14TSFastDbgCntl_PKcz, @function > _Z9TSFastDbgP14TSFastDbgCntl_PKcz: > > See how that is a comdat section. Hmmm it seems you are saying that inline (or weak linkage by any other name) in C++ somehow prohibits inlining. I thought that, in C++, a weak linkage function may or may not be inlined. If it isn't, its object code must be in a vague linkage section. But there is no requirement for its object code to appear in a vague linkage section, is there?