This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: inline functions not getting internal linkage in x86 without optimization

> C++ specifies that inline implies internal linkage.

Could you provide some support for this claim? In [], I see
the definition for internal linkage:

>> A name having namespace scope (3.3.5) has internal linkage if it is
>> the name of 
>> - an object, reference, function or function template that is
>> explicitly declared static or,
>> - an object or reference that is explicitly declared const and
>> neither explicitly declared extern nor previously declared to have
>> external linkage; or
>> - a data member of an anonymous union.

Neither applies, so the function has not internal linkage. So the next
paragraph says

>> A name having namespace scope has external linkage if it is the
>> name of
>> - a function, unless it has internal linkage; or

bar is a function that does not have internal linkage, so it has
external linkage.

Your program violates one definition rule, specifically

>> There can be more than one definition of a class type (clause 9),
>> enumeration type (7.2), inline function with external linkage
>> (7.1.2), ... Given such an entity named D defined in more than one
>> translation unit, then ...  each definition of D shall consist of
>> the same sequence of tokens; ...

Your PwrPC compiler is still correct:

>> ... If the definitions of D do not satisfy these requirements, then
>> the behavior is undefined.

Hope this helps,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]