Title
Agreement of language linkage or linkage-specifications?
Status
cd2
Section
9.11 [dcl.link]
Submitter
Daveed Vandevoorde

Created on 2006-03-08.00:00:00 last changed 143 months ago

Messages

Date: 2009-03-15.00:00:00

[Voted into the WP at the March, 2009 meeting.]

Date: 2008-06-15.00:00:00

Proposed resolution (June, 2008):

Change 9.11 [dcl.link] paragraph 5 as follows:

If two declarations of the same function or object declare functions with the same name and parameter-type-list (9.3.4.6 [dcl.fct]) to be members of the same namespace or declare objects with the same name to be members of the same namespace specify different linkage-specifications (that is, the linkage-specifications of these declarations specify different string-literals) and the declarations give the names different language linkages, the program is ill-formed if the declarations appear in the same translation unit, and the one definition rule (6.3 [basic.def.odr]) applies; no diagnostic is required if the declarations appear in different translation units.
Date: 2006-03-08.00:00:00

The wording of 9.11 [dcl.link] paragraph 5 is suspect:

If two declarations of the same function or object specify different linkage-specifications (that is, the linkage-specifications of these declarations specify different string-literals), the program is ill-formed if the declarations appear in the same translation unit, and the one definition rule (3.2) applies if the declarations appear in different translation units.

But what if only one of the declarations has a linkage-specification, while the other is left with the default C++ linkage? Shouldn't this restriction be phrased in terms of the functions’ or objects’ language linkage rather than linkage-specifications?

(Additional note [wmm]: Is the ODR the proper vehicle for enforcing this requirement? This is dealing with declarations, not necessarily definitions. Shouldn't this say “ill-formed, no diagnostic required” instead of some vague reference to the ODR?)

History
Date User Action Args
2010-03-29 00:00:00adminsetstatus: wp -> cd2
2009-08-03 00:00:00adminsetstatus: dr -> wp
2009-03-23 00:00:00adminsetmessages: + msg2025
2009-03-23 00:00:00adminsetstatus: ready -> dr
2008-10-05 00:00:00adminsetstatus: review -> ready
2008-06-29 00:00:00adminsetmessages: + msg1699
2008-06-29 00:00:00adminsetstatus: drafting -> review
2006-11-05 00:00:00adminsetstatus: open -> drafting
2006-03-08 00:00:00admincreate