Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constructor Node(const indirect<Node>& parent) can't be called #214

Closed
Ukilele opened this issue Nov 14, 2023 · 2 comments
Closed

Constructor Node(const indirect<Node>& parent) can't be called #214

Ukilele opened this issue Nov 14, 2023 · 2 comments
Assignees

Comments

@Ukilele
Copy link
Collaborator

Ukilele commented Nov 14, 2023

This issue is a consequence of #186 (which itself was a consequence of #128). I came up with a (possibly contrived) issue with the latest version of our constructor:

#include <https://raw.githubusercontent.com/jbcoe/value_types/main/indirect.h>

struct Node {
    Node() = default; //ctor 1
    Node(xyz::indirect<Node>& parent) {} //ctor 2
};

void f() {
    xyz::indirect<Node> root;
    xyz::indirect<Node> child(root); //This will call the copy constructor of indirect and not the ctor 2 of Node
}

I know that in #159, I was complaining about the exactly opposite behavior that I am complaining about now. I am not sure what the desired behavior is. Should xyz::indirect<Node> child(root); call the copy-constructor of indirect or ctor 2 of Node?

@jbcoe
Copy link
Owner

jbcoe commented Nov 14, 2023

At first glance, the current behaviour is correct.

A a;
A aa(a); // I'd expect `A(const A&)` to be called

Please let me know if I've got this muddled.

@jbcoe jbcoe assigned jbcoe and Ukilele and unassigned jbcoe Nov 15, 2023
@jbcoe
Copy link
Owner

jbcoe commented Nov 19, 2023

Guessing that this is ok. @Ukilele please re-open if I'm mistaken.

@jbcoe jbcoe closed this as completed Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants