Bug 58148 - [4.9 Regression] Fails to insert iterator range into sequence container with -D_GLIBCXX_DEBUG when conversion is needed
Summary: [4.9 Regression] Fails to insert iterator range into sequence container with ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: 4.9.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-13 09:45 UTC by Ai Azuma
Modified: 2013-08-30 21:04 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2013-08-25 00:00:00


Attachments
reproducing source code and output of -v option (1.70 KB, text/plain)
2013-08-13 09:45 UTC, Ai Azuma
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ai Azuma 2013-08-13 09:45:25 UTC
Created attachment 30644 [details]
reproducing source code and output of -v option

The following valid code fails to compile with 4.9.0 20130804 and `-D_GLIBCXX_DEBUG':

//============================
#include <vector>

int main()
{
  std::vector<wchar_t> v;
  char c = 'a';
  v.insert(v.begin(), &c, &c); // compile error
}
//============================

The above code successfully compiles with 4.9.0 20130728 and `-D_GLIBCXX_DEBUG'. So this seems a regression, which has been introduced between 20130728 and 20130804.

The same problem also occurs for `std::deque'.
Comment 1 Paolo Carlini 2013-08-13 09:52:20 UTC
Francois, can you please have a look?
Comment 2 Paolo Carlini 2013-08-25 11:15:16 UTC
-std=c++11 / gnu++11 required
Comment 3 François Dumont 2013-08-30 20:55:39 UTC
Author: fdumont
Date: Fri Aug 30 20:55:37 2013
New Revision: 202121

URL: http://gcc.gnu.org/viewcvs?rev=202121&root=gcc&view=rev
Log:
2013-08-30  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/58148
	* include/debug/functions.h (__foreign_iterator_aux4): Use
	sequence const_pointer as common type to compare pointers. Add a
	fallback overload in case pointers cannot be cast to sequence
	const_pointer.
	* testsuite/23_containers/vector/modifiers/insert/58148.cc: New.

Added:
    trunk/libstdc++-v3/testsuite/23_containers/vector/modifiers/insert/58148.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/debug/functions.h
Comment 4 Paolo Carlini 2013-08-30 21:04:41 UTC
Fixed.