simonlynen/yaml-cpp

Inconsistent behaviour with default constructed YAML::Node

Opened this issue · 1 comments

Consider the following example:

YAML::Node a = 42;
YAML::Node b = a;
a = "hello"; // now a and b both contain "hello"

YAML::Node c;
YAML::Node d = c;
c = "hello"; // now c contains "hello" and d is still empty!


What is the expected output? What do you see instead?

I would expect both c and d to contain "hello", as is the case for a and b.

What version of the product are you using?

hg default branch.

Please provide any additional information below.

This issue was discovered in the course of writing this answer:
http://stackoverflow.com/a/28156535/1639256

Original issue reported on code.google.com by oktal3...@gmail.com on 27 Jan 2015 at 3:39

Thanks for filing the issue.

I agree this is confusing, but I'm not sure this isn't WAI, at least for now. 
Unfortunately, the API has some corner cases that I didn't predict when I wrote 
it, e.g., Issue 208.

I'll look into this, and I may merge it with that issue and punt until I redo 
these corner cases a bit.

Original comment by jbe...@gmail.com on 28 Jan 2015 at 1:30

  • Added labels: Component-New-API