[Bug libstdc++/42261] infinite recursion from string(string::size_type(6), string::size_type('f'))

paolo dot carlini at oracle dot com gcc-bugzilla@gcc.gnu.org
Thu Dec 10 17:08:00 GMT 2009



------- Comment #7 from paolo dot carlini at oracle dot com  2009-12-10 17:07 -------
Grunt. Now I found the time to look in detail into the famous "do the right
thing" clause, and in fact casting only the first argument was on purpose, see
the last WP, 23.2.3/14. C++03 was different, with both casts, but we decided to
implement these new bits and it doesn't make sense at all to go back and forth
in this string constructor. I'm going to revert the patch and close as invalid.

14 For every sequence container defined in this Clause and in Clause 21:
— If the constructor

  template <class InputIterator>
  X(InputIterator first, InputIterator last,
    const allocator_type& alloc = allocator_type())

is called with a type InputIterator that does not qualify as an input iterator,
then the constructor will behave as if the overloaded constructor:

  X(size_type, const value_type& = value_type(),
    const allocator_type& = allocator_type())

were called instead, with the arguments static_cast<size_type>(first), last and
alloc, respectively.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


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



More information about the Gcc-bugs mailing list