g++ではうまくいかない?

VCでならコンパイルが通るのに,g++ではうまくいかなかった.
g++でコンパイルした場合,関数test の中のconst_iteratorの宣言のとこで負ける.
なぜだろう….

#include <vector>
#include <iostream>

using namespace std;

template <class T>
void test(const vector<T>& vec){
 for(vector<T>::const_iterator it=vec.begin();it!=vec.end();it++)
  cout << *it << endl;
}


int main(){
 vector<int> vec;

 vec.push_back(100);
 vec.push_back(100);
 vec.push_back(100);
 vec.push_back(100);

 test<int>(vec);
 
}