Skip to content

gsl_byte does not include cstddef so typedef to std::byte is inconsistent #772

Description

@nickbopp

It looks like #713 reported a bug with new compilers + old stdlib relying on a std::byte that does not exist. The fix in #714 tries to resolve that by checking __cpp_lib_byte. It seems like it does not pull in <cstddef> before doing so, though. I am seeing this manifest as an inconsistent definition of gsl::byte throughout my project. In places where I happened to include <cstddef> before <gsl/gsl_byte>, it becomes an alias for std::byte. In places where I did not include <cstddef>, gsl::byte is a unique type. These two objects then fail to link together when they have gsl::byte on their interface and they don't agree on its implementation.

I've fixed this for now on my side by doing an explicit #include <cstddef> everywhere before including <gsl/gsl_byte>, but I think it would be nice to have this fixed.

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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions