[Bug libstdc++/26974] hidden declarations klobber STL
pcarlini at suse dot de
gcc-bugzilla@gcc.gnu.org
Thu Apr 20 10:20:00 GMT 2006
------- Comment #18 from pcarlini at suse dot de 2006-04-20 10:20 -------
This is a self-contained example:
namespace mine1
{
struct mini_iter
{
mini_iter(int* p)
: _M_current(p) { }
int&
operator*() const
{ return *_M_current; }
mini_iter&
operator++()
{
++_M_current;
return *this;
}
private:
int* _M_current;
};
}
namespace mine2
{
template<typename _OutputIterator, typename _Size, typename _Tp>
_OutputIterator
fill_n(_OutputIterator __first, _Size __n, const _Tp& __value)
{
for (; __n > 0; --__n, ++__first)
*__first = __value;
return __first;
}
void f(int* p) { fill_n(mine1::mini_iter(p), 1, 1); }
}
template<typename T>
int operator,(int i, T t) { __builtin_trap(); return i; }
int main()
{
int arr[1];
mine2::f(arr);
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26974
More information about the Gcc-bugs
mailing list