This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-12-20
[Voted into WP at August, 2010 meeting.]
I thought this case would result in undefined behavior according to6.3 [basic.def.odr]:
// t.h: struct A { void (*p)(); }; // t1.cpp: #include "t.h" // A::p is a pointer to C++ func // t2.cpp: extern "C" { #include "t.h" // A::p is a pointer to C func }...but I don't see how any of the bullets in the list in paragraph5 apply.
Proposed resolution (March, 2010):
Add a new bullet following 6.3 [basic.def.odr] paragraph 5,second bullet:
...Given such an entity namedD defined in more than onetranslation unit, then
each definition ofD shall consist of thesame sequence of tokens; and
in each definition ofD, corresponding names,looked up according to 6.5 [basic.lookup], shall refer toan entity defined within the definition ofD, or shallrefer to the same entity, after overload resolution (12.2 [over.match]) and after matching of partial templatespecialization (13.10.4 [temp.over]), except that a namecan refer to a const object with internal or no linkage if theobject has the same literal type in all definitions ofD, and the object is initialized with a constantexpression (7.7 [expr.const]), and the value (but notthe address) of the object is used, and the object has the samevalue in all definitions ofD; and
in each definition ofD, correspondingentities shall have the same language linkage; and
...