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: Tue, 28 Apr 2026 15:40:58 -0700
On Tuesday, 28 April 2026 15:12:26 Pacific Daylight Time Sebastian Wittmeier
via Std-Proposals wrote:
> Could template member functions, declared in the class together with private
> extension functions, which change overload resolution, be a small issue?

Yes, that could cause an ODR violation. You don't need templates for that
either. Plus, you can get violations without overloads, by using requires
clauses.

> Are there ODR violations, if different TUs have different function
> overloads, which the I instantiated template member functions call?

If there are ODR violations, it's IFNDR. It doesn't matter which one it calls.
You messed up.

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

Received on 2026-04-28 22:41:07