[Bug libstdc++/67374] New: std::cbegin can't call valarray range access functions
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Aug 27 17:34:00 GMT 2015
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);
}
More information about the Gcc-bugs
mailing list