Movatterモバイル変換


[0]ホーム

URL:


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


1614. Address of pure virtual function vs odr-use

Section:6.3  [basic.def.odr]    Status:CD4    Submitter:Richard Smith    Date:2013-01-31

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

According to 6.3 [basic.def.odr] paragraph 3,

A function whose name appears as a potentially-evaluated expression isodr-used if it is the unique lookup result or the selected member of a setof overloaded functions (6.5 [basic.lookup],12.2 [over.match], 12.3 [over.over]), unless it is a purevirtual function and its name is not explicitly qualified.

In the following example, consequently,S::f is odr-used butnot defined, and (because it is an undefined odr-used inline function) adiagnostic is required:

  namespace {    struct S {      inline virtual void f() = 0;    };   void (S::*p) = &S::f;  }

However,S::f cannot be called through such apointer-to-member, so forming a pointer-to-member should notcause a pure virtual function to be odr-used. There isimplementation divergence on this point.

Proposed resolution (April, 2013):

Change 6.3 [basic.def.odr] paragraph 3 as follows:

...A virtual member function is odr-used if it is not pure. A functionwhose name appears as a potentially-evaluated expression is odr-used if itis the unique lookup result or the selected member of a set of overloadedfunctions (6.5 [basic.lookup], 12.2 [over.match],12.3 [over.over]), unless it is a pure virtual function andeither its name is not explicitly qualifiedor theexpression forms a pointer to member (5.3.1). [Note:...



[8]ページ先頭

©2009-2026 Movatter.jp