Skip to content

FYI gcc warns of 'const qualifier ignored on return type' #1

Description

@willwray

https://wandbox.org/permlink/EjDDKW72cTOKB3et
^^^ cut n paste the span snippet to wandbox with recent gcc gives vvv

4x warning: type qualifiers ignored on function return type on cbegin() and cend()
(and a couple of signed/unsigned comparison warning in the test code)

I managed to quieten the warnings by

  • adding a const_pointer typedef with const added to the type
  • updating const_iterator typedef from const pointer to const_pointer
    (or, just update const_iterator but I prefer to also have a const_pointer typedef).
    using const_pointer  = _Tp const*;     // added
    using const_iterator = const_pointer;  // updated

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions