C++ Logo

sg12

Advanced search

Re: [ub] Proposal: make self-initialized references ill-formed (C++17?)

From: Jens Maurer <Jens.Maurer_at_[hidden]>
Date: Mon, 22 Sep 2014 18:02:08 +0200
On 09/22/2014 02:15 PM, John Zwinck wrote:
> The initializer shall not mention the reference being initialized.

So, something like the following would be ill-formed?

const int& i = sizeof(i);
const int& j = f<decltype(j)>();


> Any use of a reference which has not yet been initialized is
> ill-formed.

That seems unimplementable, because order-of-initialization
for global variables is unspecified between translation units.

Jens

Received on 2014-09-22 18:07:22