C++ Logo

std-discussion

Advanced search

Re: Odr-use

From: Russell Shaw <rjshaw_at_[hidden]>
Date: Fri, 15 Nov 2024 00:22:19 +1100
On 14/11/24 22:47, Ville Voutilainen wrote:
> On Thu, 14 Nov 2024 at 13:09, Russell Shaw via Std-Discussion
> <std-discussion_at_[hidden]> wrote:
>
>> So "struct S { static const int x = 0; };" 'defines' 'S::x' because it has an
>> initializer, yet has no memory location ?
>
> Right, it has no memory location, but the value is known, and known
> not to change, so anything
> that just uses the value but doesn't need the address can simply be
> replaced by that value.

Later, it says:

"A structured binding is odr-used if it appears as a potentially-evaluated
expression."

--------------------------
int a[1];

auto [x] = a; <---- (A)
--------------------------

Is (A) the "structured binding" and "potentially-evaluated expression." ? Or a
declaration ?

Or is 'x' the "structured binding" ?

Received on 2024-11-14 13:22:24