Title
Language linkage of static member functions
Status
c++23
Section
9.11 [dcl.link]
Submitter
Davis Herring

Created on 2021-03-11.00:00:00 last changed 9 months ago

Messages

Date: 2022-11-11.09:37:54

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

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

A C language linkage is ignored in determining the language linkage of class members, friend functions with a trailing requires-clause, and the function type of non-static class member functions.
Date: 2021-08-15.00:00:00

Notes from the August, 2021 teleconference:

There was some question as to whether a linkage specification should affect the language linkage of any function declarators within class scope. The question was also raised as to whether some non-typedef syntax should be available for affecting language linkage, which would be a question for EWG.

Date: 2022-02-18.07:47:23

Suggested resolution:

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

A C language linkage is ignored in determining the language linkage of class members, friend functions with a trailing requires-clause, and the function type of non-static class member functions.
Date: 2023-02-15.00:00:00

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

According to 9.11 [dcl.link] paragraph 5,

A C language linkage is ignored in determining the language linkage of class members, friend functions with a trailing requires-clause, and the function type of class member functions.

It doesn't make sense that static member functions should behave 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
     };
   }
History
Date User Action Args
2023-07-16 13:00:43adminsetstatus: open -> c++23
2023-07-16 13:00:43adminsetstatus: dr -> open
2023-02-18 18:43:04adminsetstatus: ready -> dr
2023-02-07 14:43:26adminsetstatus: tentatively ready -> ready
2022-11-11 09:37:54adminsetmessages: + msg6999
2022-11-11 09:37:54adminsetstatus: open -> tentatively ready
2022-02-18 07:47:23adminsetmessages: + msg6723
2021-11-15 00:00:00adminsetmessages: + msg6555
2021-03-11 00:00:00admincreate