Title
overly-strict requirements for names with C language linkage
Status
cd4
Section
9.11 [dcl.link]
Submitter
Richard Smith

Created on 2013-06-29.00:00:00 last changed 49 months ago

Messages

Date: 2014-11-15.00:00:00

[Moved to DR at the November, 2014 meeting.]

Date: 2014-05-27.00:00:00

Additional note, May, 2014:

It was observed that this resolution would allow a definition of main as a C-linkage variable in a namespace. The issue is being returned to "review" status for further discussion.

Date: 2014-02-15.00:00:00

Proposed resolution (February, 2014):

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

...An entity with C language linkage shall not be declared with the same name as an entity a variable in global scope, unless both declarations denote the same entity; no diagnostic is required if the declarations appear in different translation units...
Date: 2014-02-15.00:00:00

Additional note (February, 2014):

See also issue 1838 for an interaction with using-declarations.

Date: 2013-06-29.00:00:00

According to 9.11 [dcl.link] paragraph 6,

An entity with C language linkage shall not be declared with the same name as an entity in global scope, unless both declarations denote the same entity; no diagnostic is required if the declarations appear in different translation units.

This restriction is too broad; it does not allow for the so-called stat hack, where a C-linkage function and a class are both declared in global scope, and it does not allow for function overloading, either. It should be revised to apply only to variables.

History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: drwp -> cd4
2015-05-25 00:00:00adminsetstatus: dr -> drwp
2015-04-13 00:00:00adminsetmessages: + msg5372
2014-11-24 00:00:00adminsetstatus: ready -> dr
2014-07-07 00:00:00adminsetstatus: review -> ready
2014-05-27 00:00:00adminsetmessages: + msg4992
2014-05-27 00:00:00adminsetstatus: ready -> review
2014-03-03 00:00:00adminsetmessages: + msg4826
2014-03-03 00:00:00adminsetmessages: + msg4825
2014-03-03 00:00:00adminsetstatus: drafting -> ready
2013-10-14 00:00:00adminsetstatus: open -> drafting
2013-06-29 00:00:00admincreate