certik / yaml-cpp

Automatically exported from code.google.com/p/yaml-cpp
MIT License
0 stars 0 forks source link

Inconsistent behaviour with default constructed YAML::Node #271

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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