Skip to content

C++: Consider representing value-initialized POD classes as ClassAggregateLiterals #4769

Open
@dbartol

Description

@dbartol

Consider code like:

struct Test {};
const Test t = Test();

We represent the Test() object as a Literal node with type const Test and value 0. This is basically correct, but it's somewhat odd to have an expression of class type with an integer value. It might be less confusing to represent that temporary object as a ClassAggregateLiteral instead. I believe they should have the same semantics, although it could be argued that ClassAggregateLiteral is intended solely for the syntax that uses a braced initializer list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions