Skip to content

Potential issues with Field copy constructors. #914

Description

@d7919

I've just come across a potential issue with the field copy constructors. These just give the new field a reference to the existing data block, which we call checkData on if CHECK > 2.

Consider the following case

Field2D a;
a.allocate();
Field2D b(a);

In the copy constructor call to make b we will checkData on the data block of a. This has been allocated but it has not been initialised so the checkData output is undefined (i.e. it could throw or it could not).

I think the only ways to avoid this undefined behaviour would be to either remove the checkData call in copy constructors or to ensure allocate initialises the data block.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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