C++ Logo

std-proposals

Advanced search

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

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sat, 20 Jun 2026 13:46:23 -0700
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.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.

Received on 2026-06-20 20:46:36