Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1589368

Summary: --std=c++11 regression 'call of overloaded vector::insert is ambiguous'
Product: Red Hat Enterprise Linux 7 Reporter: Serguei Makarov <smakarov>
Component: gccAssignee: Marek Polacek <mpolacek>
Status: CLOSED ERRATA QA Contact: Michael Petlan <mpetlan>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.5CC: fweimer, jakub, jwakely, mcermak, ohudlick
Target Milestone: rcKeywords: TestBlocker
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: gcc-4.8.5-36.el7 Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 07:27:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Serguei Makarov 2018-06-08 19:49:28 UTC
Description of problem:

Packages that built with gcc-c++-4.8.5-28.el7.x86_64 no longer build in gcc-c++-4.8.5-35.el7.x86_64 from the RHEL 7.5 nightly repo.

Version-Release number of selected component (if applicable):
gcc-c++-4.8.5-35.el7.x86_64

How reproducible:

$ cat >reproducer.cxx
#include <vector>
#include <string>

using namespace std;

int main () {
        vector<string> cmd;
        auto mode = "always";
        cmd.insert(cmd.end(), { "-C", mode });
}

$ g++ --std=c++11 reproducer.cxx -o reproducer

Actual results:

reproducer.cxx: In function ‘int main()’:
reproducer.cxx:9:45: error: call of overloaded ‘insert(std::vector<std::basic_string<char> >::iterator, <brace-enclosed initializer list>)’ is ambiguous
         cmd.insert(cmd.end(), { "-C", mode });
                                             ^
reproducer.cxx:9:45: note: candidates are:
In file included from /usr/include/c++/4.8.2/vector:69:0,
                 from reproducer.cxx:1:
/usr/include/c++/4.8.2/bits/vector.tcc:107:5: note: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::iterator, const value_type&) [with _Tp = std::basic_string<char>; _Alloc = std::allocator<std::basic_string<char> >; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<std::basic_string<char>*, std::vector<std::basic_string<char> > >; typename std::_Vector_base<_Tp, _Alloc>::pointer = std::basic_string<char>*; std::vector<_Tp, _Alloc>::value_type = std::basic_string<char>]
     vector<_Tp, _Alloc>::
     ^
In file included from /usr/include/c++/4.8.2/vector:64:0,
                 from reproducer.cxx:1:
/usr/include/c++/4.8.2/bits/stl_vector.h:988:7: note: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::iterator, std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::basic_string<char>; _Alloc = std::allocator<std::basic_string<char> >; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<std::basic_string<char>*, std::vector<std::basic_string<char> > >; typename std::_Vector_base<_Tp, _Alloc>::pointer = std::basic_string<char>*; std::vector<_Tp, _Alloc>::value_type = std::basic_string<char>]
       insert(iterator __position, value_type&& __x)
       ^
/usr/include/c++/4.8.2/bits/stl_vector.h:1005:7: note: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::const_iterator, std::initializer_list<_Tp>) [with _Tp = std::basic_string<char>; _Alloc = std::allocator<std::basic_string<char> >; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<std::basic_string<char>*, std::vector<std::basic_string<char> > >; typename std::_Vector_base<_Tp, _Alloc>::pointer = std::basic_string<char>*; std::vector<_Tp, _Alloc>::const_iterator = __gnu_cxx::__normal_iterator<const std::basic_string<char>*, std::vector<std::basic_string<char> > >; typename __gnu_cxx::__alloc_traits<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type>::const_pointer = const std::basic_string<char>*]
       insert(const_iterator __position, initializer_list<value_type> __l)

Expected results:

Program compiles and runs without errors.

Additional info:

Package obtained from the following repos:

[nightly]
name=nightly for Red Hat Enterprise Linux $releasever
baseurl=http://download.lab.bos.redhat.com/nightly/latest-RHEL-7/compose/Server/x86_64/os
enabled=1
gpgcheck=0

[nightly-opt]
name=nightly for Red Hat Enterprise Linux $releasever
baseurl=http://download.lab.bos.redhat.com/nightly/latest-RHEL-7/compose/Server-optional/x86_64/os
enabled=1
gpgcheck=0

[nightly-debug]
name=nightly debug for Red Hat Enterprise Linux $releasever
baseurl=http://download.lab.bos.redhat.com/nightly/latest-RHEL-7/compose/Server/x86_64/debug/tree
enabled=1
gpgcheck=0

[nightly-opt-debug]
name=nightly debug for Red Hat Enterprise Linux $releasever
baseurl=http://download.lab.bos.redhat.com/nightly/latest-RHEL-7/compose/Server-optional/x86_64/debug/tree
enabled=1
gpgcheck=0

Comment 2 Serguei Makarov 2018-06-08 19:52:54 UTC
This bug probably relates to related components, e.g. libstdc++-devel-4.8.5-35.el7.x86_64, rather than the gcc package itself.

Comment 3 Michael Petlan 2018-06-11 12:07:21 UTC
Reproduced; gcc-4.8.5-34.el7 still builds your reproducer OK, -35.el7 fails.

Comment 6 Marek Polacek 2018-06-11 15:40:42 UTC
Caused by my changes in #1575888, whereby I adjusted std::vector::insert signatures to match what's documented in http://en.cppreference.com/w/cpp/container/vector/insert.

Looks like we need r200458 too, but this is getting a little bit crazy; maybe we should back out the changes made in #1575888 and suggest using DTS for C++11 there.

Comment 8 Marek Polacek 2018-06-12 17:52:49 UTC
I'm backing out the changes made in -35.

Comment 11 Michael Petlan 2018-07-20 16:26:21 UTC
Related tests passed with gcc-4.8.5-36.el7.
VERIFIED.

Comment 13 errata-xmlrpc 2018-10-30 07:27:17 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3016