CWG Issue 1708 (original) (raw)
This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-11-05
1708. overly-strict requirements for names with C language linkage
Section: 9.12 [dcl.link]Status: CD4Submitter: Richard SmithDate: 2013-06-29
[Moved to DR at the November, 2014 meeting.]
According to 9.12 [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-calledstat 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.
Additional note (February, 2014):
See also issue 1838 for an interaction with using-declarations.
Proposed resolution (February, 2014):
Change 9.12 [dcl.link] paragraph 6 as follows:
...An entity with C language linkage shall not be declared with the same name as
an entitya variable in global scope, unless both declarations denote the same entity; no diagnostic is required if the declarations appear in different translation units...
Additional note, May, 2014:
It was observed that this resolution would allow a definition ofmain as a C-linkage variable in a namespace. The issue is being returned to "review" status for further discussion.