Movatterモバイル変換


[0]ホーム

URL:


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


2483. Language linkage of static member functions

Section:9.12  [dcl.link]    Status:C++23    Submitter:Davis Herring    Date:2021-03-11

[Accepted as a DR at the February, 2023 meeting.]

According to 9.12 [dcl.link] paragraph 5,

A C language linkage is ignored in determining the languagelinkage of class members, friend functions with atrailingrequires-clause, and the function type ofclass member functions.

It doesn't make sense that static member functions shouldbehave like non-static member functions in this regard:

   extern "C" {     struct A {       static void f();       constexpr static void (*p)()=f; // error: must point to a function whose type has C language linkage     };   }

Suggested resolution:

Change 9.12 [dcl.link] paragraph 5 as follows:

A C language linkage is ignored in determining the languagelinkage of class members, friend functions with atrailingrequires-clause, and the function type ofnon-static class member functions.

Notes from the August, 2021 teleconference:

There was some question as to whether a linkagespecification should affect the language linkage of anyfunction declarators within class scope. The question wasalso raised as to whether some non-typedef syntax should beavailable for affecting language linkage, which would be aquestion for EWG.

Proposed resolution (approved by CWG 2022-11-10):

Change 9.12 [dcl.link] paragraph 5 as follows:

A C language linkage is ignored in determining the languagelinkage of class members, friend functions with atrailingrequires-clause, and the function type ofnon-static class member functions.



[8]ページ先頭

©2009-2025 Movatter.jp