Skip to content

[basic.scope.pdecl]/1 Example is outdated #3578

@languagelawyer

Description

@languagelawyer

From https://stackoverflow.com/questions/59442521/use-of-variable-in-own-initializer
After the resolution of CWG2256¹ changed the rules of an object lifetime start, unsigned char x = x; no longer initializes x with its own indeterminate value as the Example in [basic.scope.pdecl]/1 says, but triggers undefined behavior, because the initializer accesses the object whose lifetime has not started yet (because variable initialization hasn't completed).


  1. Which, if ignore references, kinda mixes variables with objects…

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions