This is the mail archive of the libstdc++-prs@sources.redhat.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

libstdc++/102: <vector> and std::rel_ops broken.



>Number:         102
>Category:       libstdc++
>Synopsis:       <vector> and std::rel_ops broken.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 04 11:07:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     mark@codesourcery.com
>Release:        unknown-1.0
>Organization:
>Environment:
i686-pc-linux-gnu
>Description:
This code:

#include <vector.h>

int main ()
{
  vector<int> v1;
  vector<int> v2 (v1);
}

gets a legitimate compiler error indicating that:

/mnt/u5/mitchell/egcs-4/libstdc++-v3/include/bits/concept_checks.h:402: ambiguous overload for `std::__normal_iterator<const int*, std::vector<int, std::allocator<int> > >& != std::__normal_iterator<const int*, std::vector<int, std::allocator<int> > >&'

/mnt/u5/mitchell/egcs-4/libstdc++-v3/include/bits/stl_relops.h:37: candidates are: bool std::rel_ops::operator!=(const _Tp&, const _Tp&) [with _Tp = std::__normal_iterator<const int*, std::vector<int, std::allocator<int> > >]

/mnt/u5/mitchell/egcs-4/libstdc++-v3/include/bits/stl_iterator.h:1046:                 bool std::operator!=(const std::__normal_iterator<_IteratorL, _Container>&, const std::__normal_iterator<_IteratorR, _Container>&) [with _IteratorL = const int*, _IteratorR = const int*, _Container = std::vector<int, std::allocator<int> >]


The problem is that the templates defined in the relops
namespace have been brought into the global namespace
via using declarations, and that neither they nor the
overloaded version for iterators is more specialized.

The same problem occurs without compatibility headers on:

#include <vector>

using namespace std;
using namespace std::rel_ops;

int main ()
{
  vector<int> v1;
  vector<int> v2 (v1);
}

but I'm not sure if the standard allows that, or not.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]