Skip to content

Commit

Permalink
Fixed invalid variant construction
Browse files Browse the repository at this point in the history
  • Loading branch information
ariostas committed Nov 14, 2024
1 parent d240524 commit 2bec106
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dev/make-root/rntuple_emptystruct_invalidvar.C
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ void rntuple_emptystruct_invalidvar() {
*variant_field = 1; // valid state
ntuple->Fill();

variant_field->emplace<StructForVariant>(2); // valid state
ntuple->Fill();

try {
*variant_field = StructForVariant(); // invalid state
} catch (const std::runtime_error &e) {
std::cerr << "Caught exception: " << e.what() << std::endl;
}
assert(variant_field->valueless_by_exception());
ntuple->Fill();

variant_field->emplace<StructForVariant>(2); // valid state
ntuple->Fill();
}
Binary file not shown.

0 comments on commit 2bec106

Please sign in to comment.