Skip to content

Conversation

@Romain-Geissler-1A
Copy link

With clang >= 21, using is_signed/is_unsigned with "small" enums (having an underlying type smaller than an int) results in strong error, after being reported as warnings for years (see #171).

Since boost::is_signed/is_unsigned differs explicitly from the std one, and can return "true" for enums (contrary to the std one), keep this boost behavior and implement a special check for enums.

This allows in particular boost::lexical_cast to keep working when converting non-scoped enums from int to strings with clang >= 21, see boostorg/lexical_cast#87).

With clang >= 21, using is_signed/is_unsigned with "small" enums
(having an underlying type smaller than an int) results in strong error,
after being reported as warnings for years (see boostorg#171).

Since boost::is_signed/is_unsigned differs explicitly from the std one,
and can return "true" for enums (contrary to the std one), keep this
boost behavior and implement a special check for enums.

This allows in particular boost::lexical_cast to keep working when
converting non-scoped enums from int to strings with clang >= 21,
see boostorg/lexical_cast#87).
@Romain-Geissler-1A
Copy link
Author

Ping

1 similar comment
@Romain-Geissler-1A
Copy link
Author

Ping

@jzmaddock
Copy link
Collaborator

The problem you have here, is that underlying_type gets instantiated unconditionally regardless of the argument, or whether the result is used.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants