public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/67374] New: std::cbegin can't call valarray range access functions
@ 2015-08-27 17:34 redi at gcc dot gnu.org
  2015-08-27 17:34 ` [Bug libstdc++/67374] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2015-08-27 17:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67374

            Bug ID: 67374
           Summary: std::cbegin can't call valarray range access functions
           Product: gcc
           Version: 4.9.4
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: redi at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

This fails:

#include <valarray>
#include <iterator>

int main()
{
  std::valarray<int> v;
  std::cbegin(v);
}

The problem is that the begin overloads in <valarray> are not declared before
the non-member functions in <bits/range_access.h> so can't be called from
there.

This works:

namespace std {
    template<class _Tp>
      struct valarray;

    template<class _Tp>
    inline _Tp*
    begin(valarray<_Tp>& __va);

  /**
   *  @brief  Return an iterator pointing to the first element of
   *          the const valarray.
   *  @param  __va  valarray.
   */
  template<class _Tp>
    inline const _Tp*
    begin(const valarray<_Tp>& __va);

}

#include <valarray>
#include <iterator>

int main()
{
  std::valarray<int> v;
  std::cbegin(v);
}


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-09-03 15:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-27 17:34 [Bug libstdc++/67374] New: std::cbegin can't call valarray range access functions redi at gcc dot gnu.org
2015-08-27 17:34 ` [Bug libstdc++/67374] " redi at gcc dot gnu.org
2015-08-27 18:43 ` redi at gcc dot gnu.org
2015-08-27 19:05 ` redi at gcc dot gnu.org
2015-09-03 15:11 ` redi at gcc dot gnu.org
2015-09-03 15:12 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).