This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Can not declare std::map::iterator in template (error: expected `;' before "my_A_iterator")


I have the strange problem that I can not declare a std::map::iterator
inside a template:

#include <map>
template<typename S> struct A {};
template<typename T> struct B {
    typedef A<T> G;
    void f(G const & a) {
        std::map<G const *, int> my_As;
        std::map<G const *, int>::iterator my_A_iterator = my_As.find(&a);
    }
};


The compiler says «error: expected `;' before "my_A_iterator"». If I
change A<T> to for example bool, it compiles. What could possibly be
wrong? I tried both g++-4.2.1 and g++-4.2.2.


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