------- Comment #1 from redi at gcc dot gnu dot org  2009-12-03 11:34 -------
(In reply to comment #0)
> This leads to an infinite recursion between these two methods:
> 
>       // _GLIBCXX_RESOLVE_LIB_DEFECTS
>       // 438. Ambiguity in the "do the right thing" clause
>       template<class _Integer>
>         static _CharT*
>         _S_construct_aux(_Integer __beg, _Integer __end,
>                          const _Alloc& __a, __true_type)
>         { return _S_construct(static_cast<size_type>(__beg), __end, __a); }

GCC 4.1 also cast __end to static_cast<value_type>(__end) which prevents the
recursion.  I'm not sure why that was removed as part of resolving DR 438, it
looks necessary to me, but Paolo will know better


> 
>       template<class _InIterator>
>         static _CharT*
>         _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a)
>         {
>           typedef typename std::__is_integer<_InIterator>::__type _Integral;
>           return _S_construct_aux(__beg, __end, __a, _Integral());
>         }
> 
> The infinite recursion also happens with GCC 4.3.2.  GCC 4.1.3 constructs a
> string containing "ffffff".
> 
> I'm not familiar enough with the standard to know whether GCC 4.1.3 is 
> correct,
> or whether 4.3.2 and 4.4.1 are (or whether neither behaviour is right), but
> generating an infinite loop for seemingly innocent looking code seems
> unhelpful.
> 
> FWIW, the Comeau online compiler accepts the code, but I can't tell how it
> interprets it.
> 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42261

Reply via email to