This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-11-11


2104. Internal-linkage constexpr references and ODR requirements

Section: 6.3  [basic.def.odr]     Status: CD4     Submitter: James Widman     Date: 2015-03-17

[Adopted at the February, 2016 meeting.]

In an example like:

  extern int i;
  namespace {
    constexpr int& r = i;
  }
  inline int f() { return r; }

use of f() in multiple translation units results in an ODR violation because of use of the internal-linkage reference r. It would be helpful if 6.3 [basic.def.odr] paragraph 6 could be amended to “look through” a constexpr reference in determining whether an inline function violates the ODR or not.

Proposed resolution (January, 2016):

Change 6.3 [basic.def.odr] bullet 6.2 as follows, dividing the running text into a bulleted list:

...Given such an entity named D defined in more than one translation unit, then