Skip to content

std::ipv4_network validation error not correctly reported #619

@DariushMoh

Description

@DariushMoh

I encountered an error while trying to set an ipv4 network on an entity:

Invalid value '172.25.103.22/24', does not match constraint `std::validate_type('ipaddress.IPv4Network',self)

But after some more investigation, it seems I forgot to use the network address. This was not correctly reported by the compiler. When I test the actual python type I get this:

>>> ipaddress.IPv4Network("172.25.103.22/24")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.12/ipaddress.py", line 1544, in __init__
    raise ValueError('%s has host bits set' % self)
ValueError: 172.25.103.22/24 has host bits set

This would be good to report this in the compiler output error. Here is the minimal example I used to reproduce the error:

entity A:
    std::ipv4_network net
end
implement A using std::none

A(net="172.25.103.22/24")

Metadata

Metadata

Assignees

No one assigned

    Labels

    usabilityThis ticket is related to improved usability

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions