-
Notifications
You must be signed in to change notification settings - Fork 205
Open
Labels
Description
I have valid keywords in my kaitai struct definition.
meta:
id: nix_nar
title: Nix Archive (NAR)
file-extension: nar
endian: le
doc: |
Nix Archive (NAR) format. A simple, reproducible binary archive
format used by the Nix package manager to serialize file system objects.
doc-ref: 'https://nixos.org/manual/nix/stable/command-ref/nix-store.html#nar-format'
seq:
- id: magic
type: padded_str
doc: "Magic string, must be 'nix-archive-1'."
valid:
expr: _.body == 'nix-archive-1'
- id: root_node
type: node
doc: "The root of the archive, which is always a single node."
ksc is generating code like this:
void nix_nar_t::_read() {
m_magic = std::unique_ptr<padded_str_t>(new padded_str_t(m__io, this, m__root));
{
std::unique_ptr<padded_str_t> _ = m_magic;
if (!(_->body() == std::string("nix-archive-1"))) {
throw kaitai::validation_expr_error<std::unique_ptr<nix_nar_t::padded_str_t>>(m_magic, m__io, std::string("/seq/0"));
}
}
m_root_node = std::unique_ptr<node_t>(new node_t(m__io, this, m__root));
}The problematic line is std::unique_ptr<padded_str_t> _ = m_magic; which fails with the following error
error: use of deleted function ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = nix_nar_t::padded_str_t; _Dp = std::default_delete<nix_nar_t::padded_str_t>]’
17 | std::unique_ptr<padded_str_t> _ = m_magic;
Reactions are currently unavailable