This is an "accepts invalid code" report.

The following code happens to compile with g++ (all versions),
whereas the standard does not guarantee it should (I think).
----------------------------
#include <vector>

typedef std::vector<int>::iterator Iterator;

Iterator::value_type v;
Iterator::pointer p;
Iterator::iterator_category c;
----------------------------

The problem is that developing code with g++, and introducing this
kind of code by mistake, pops up errors later when other compilers
are used (e.g. those which have pointers for std::vector::iterator).

Would it be a good idea to make the access to such types somehow non public?
For example by making them protected and making std::iterator_traits a friend?
Or maybe only available when _GLIBCXX_DEBUG is not defined ?


-- 
           Summary: std::vector::iterator::value_type is accessible
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sylvain dot pion at sophia dot inria dot fr


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

Reply via email to