Skip to content

YAML::Node::SetTag broken on inputs starting with "!!" #1373

@MechatronixX

Description

@MechatronixX

Below is a minimal example to reproduce the issue. It appears using SetTag breaks (w.r.t console/file emitting for the very least) string_node when tagging with anything starting with "!!". Not only that string_node appears broken, but also any node where string_node is inserted. When the tagged node is inserted into root_node, writing the integer to it will not work either. Try SetTag to whatever does not begin with "!!" and the console output looks like you would probably expect, e.g.

some_string: !some_tag hello
some_int: 2

To reproduce:

    YAML::Node root_node{};
    YAML::Node string_node{"hello"};
    string_node.SetTag("!!str"); // Breaks for anything starting with "!!" Comment out this line or tag with e.g. "!some_tag" and it works as expected 

    root_node["some_string"] = string_node;
    root_node["some_int"] = 2;

    std::cout << root_node << std::endl; // Outputs "some_string: !"

Version: commit 2f86d13, latest commit on master at the time of posting
Os: Ubuntu 24
Compiler: Gcc 14.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions