Skip to content

Redefinition error not being called #112

@python36

Description

@python36

Environment

toml++ version and/or commit hash:
toml++ v2.5.0 037bfdd

Compiler:
g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

C++ standard mode:
17

Target arch:
x86

Library configuration overrides:

Relevant compilation flags:

Describe the bug

If the table was created earlier, then the redefinition error is not called

Steps to reproduce (or a small repro code sample)

This is parsed without error:

[a.b.c.d]
  u = 6
[a]
  b.t = 8
[a.b]
  u = 0

Result:

[a.b]
t = 8
u = 0

    [a.b.c.d]
    u = 6

But this is with an error:

[a]
  b.t = 8
[a.b]
  u = 0

Result:

terminate called after throwing an instance of 'toml::v2::ex::parse_error'
  what():  Error while parsing table header: cannot redefine existing table 'a.b'

Additional information

For example with tomli (Python):

>>> tomli.loads("""
... [a.b.c.d]
... u = 6
... [a]
... b.t = 8
... [a.b]
... u = 0""")
Traceback (most recent call last):
...
tomli._parser.TOMLDecodeError: Can not declare ('a', 'b') twice (at line 6, column 5)
>>> tomli.loads("""[a]
... b.t = 8
... [a.b]
... u = 0""")
Traceback (most recent call last):
...
tomli._parser.TOMLDecodeError: Can not declare ('a', 'b') twice (at line 3, column 5)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions