Skip to content

The spec should warn against using copy constructors, not warn against using postblit constructors #4184

Closed
@jmdavis

Description

@jmdavis

Due to dlang/dmd#20970, any types with a copy constructor should not be used in a dynamic array or associative array, which realistically means that no one who isn't using -betterC should be using copy constructors.

However, the spec currently has a warning on postblit constructors, telling programmers to use copy constructors in new code instead. This might make sense if druntime supported copy constructors properly, but it doesn't. And until it does, IMHO, we really need to be warning programmers against using copy constructors and instead be telling them to use postblit constructors. Personally, I wasted a considerable amount of time because of this issue, because I did not realize that the support for copy constructors was not complete, and I'm one of the core contributors, and without the spec being correct with regards to the current state of things, plenty of other folks are going to make the same mistake.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions