C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Translation-unit-local functions that access private class fields

From: Simon Schröder <dr.simon.schroeder_at_[hidden]>
Date: Sun, 21 Jun 2026 07:29:09 +0200
> On Jun 20, 2026, at 10:46 PM, Thiago Macieira via Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> On Saturday, 20 June 2026 13:13:33 Pacific Daylight Time Rhidian De Wit wrote:
>> PEMs have internal linkage by default and declaring extern functions in a
>> PEM would lead to a compiler error.
>
> No. They obey the exact same rules as regular member functions: none of them
> have internal linkage. As an optimisation exception under as-if, members of
> classes in unnamed namespaces can have internal linkage.
>
Well, we already have special rules for member functions that are defined inline. We could see PEMs the same way.

Received on 2026-06-21 05:29:27