c++/2536: Regression form g++-2.95.2 (both trunk and branch) with member typedefs

Theodore Papadopoulo Theodore.Papadopoulo@sophia.inria.fr
Wed Apr 11 09:36:00 GMT 2001


>Number:         2536
>Category:       c++
>Synopsis:       Regression form g++-2.95.2 (both trunk and branch) with member typedefs
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 11 09:36:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Théodore Papadopoulo
>Release:        3.1 20010405 (experimental)
>Organization:
INRIA
>Environment:
System: Linux mururoa 2.2.18 #1 SMP Wed Jan 17 10:27:51 MET 2001 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --srcdir=../gcc --prefix=/net/home/robotvis/gnu/gcc --enable-threads=posix --with-gnu-as --with-gnu-ld --with-as=/net/home/robotvis/gnu/binutils/bin/as --with-ld=/net/home/robotvis/gnu/binutils/bin/ld
>Description:
	The code provided below fails to compile with the Cvs g++ (trunk or branch) as of 04/11/01.
    It seems that the compiler is confused due to the using declaration....
    It tries to use the global templated libstdc++ version of iterator instead of
    the non-templated std::vector<T>::iterator version which should be preferred AFAICT
    I did not find the relevant paragraph in the standard... but at the very least, the message
    is unclear (it should report a conflict).

    Note: this is a regression from 2.95.2 or 2.95.3
    
>How-To-Repeat:
	Just compile the following piece of code:

#include <vector>

using namespace std;

template <typename T>
struct B {
    struct A: public std::vector<T> {
        //typedef std::vector<T>::iterator iterator;
        iterator begin() {
            return std::vector<T>::begin();
        }
    };
};

int
main()
{
    B<int>::A a;
    a.push_back(1);
}

mururoa->g++ test.C
test.C:8: syntax error before `(' token
test.C:11: missing ';' before right brace
test.C:12: parse error before `}' token

>Fix:
	Supress the using declaration or add the commented out line.
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list