Skip to content

Emitting multiple documents with tags fails #321

Description

@ShaiWavesAudio

The following code attempts to emit 2 documents each with a local tag:

    YAML::Emitter theEmitter;
    for (int i = 0; i < 2; ++i)
    {
        theEmitter << YAML::BeginDoc;
        theEmitter  << YAML::LocalTag("The_Tag");
        theEmitter  << YAML::BeginSeq;
        theEmitter  << "Some Value";
        theEmitter  << YAML::EndSeq;
        theEmitter  << YAML::EndDoc;
    }
    std::cout << theEmitter.c_str() << std::endl;

I expected the code to print:

--- !The_Tag
- Some Value
...
--- !The_Tag
- Some Value
...

However the actual print is:

--- !The_Tag
- Some Value
...
--- !The_Tag

It looks like the call to YAML::LocalTag("The_Tag") leaves the emitter in an error state - however no exception is thrown.

If I remove the call to YAML::LocalTag("The_Tag") the print is OK:

---
- Some Value
...

---
- Some Value
...

I'm using yaml-cpp 0.5.2 with Xcode 5 on Mac OS 10.9.
Does not happen with yaml-cpp 0.3.0.

Thanks,
Shai

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