Skip to content

[SUGGESTION] Don't accept implicit integers in [[assert: 1]] #363

Description

@realgdman

This is minor one.
When skimming through some snippets, I got impression that you can write
[[assert: 42]]
Which is actually not checking for value, (say, of short-syntax function), and just implicit converted to bool

According to this note at ES.87, checking for pointers is good, but checking integers without comparison can be suspicious.

Probably assert accepting only bools or pointers can be implemented with the help of concepts like std::is_arithmetic_v and std::is_pointer_v instead of simply bool

constexpr auto expects (bool b, CPP2_MESSAGE_PARAM msg = "" CPP2_SOURCE_LOCATION_PARAM_WITH_DEFAULT)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions