This is a somewhat curious issue as one needs fairly recent gcc (>= 4.5) _and_ gdb ( > 2010-07-29 ) to reproduce.
----------------- snip ----------------- #!/bin/sh # To reproduce: # - use g++ 4.5 or 4.6 (but not 4.4) # - use gdb from CVS from 2010-07-29 or newer echo " template<typename _ForwardIterator> void x(_ForwardIterator __first) { } template<typename T> struct vector { T* _M_start; vector() { x(_M_start); } }; struct foo {}; int main() { vector<foo> flist; foo *f = new foo; } " > foo.cpp CXX=/usr/local/bin/i686-pc-linux-gnu-g++-4.5.0 CXX=/usr/bin/g++ CXX=/usr/local/bin/i686-pc-linux-gnu-g++-4.6.0 ${CXX} -g foo.cpp -o foo GDB=~/bin/gdb-7.1 # works GDB=~/bin/gdb-7.0 # works GDB=~/debugger/fsf-git/gdb/gdb # "fails" ${GDB} -ex 'set confirm off' \ -ex 'b main' -ex 'run' -ex 'p f' -ex 'q'\ ./foo # GNU gdb (GDB) 7.2.50.20100728-cvs # [...] # Breakpoint 1 at 0x80486d2: file foo.cpp, line 18. # Breakpoint 1, main () at foo.cpp:18 # #18 foo *f = new foo; # $1 = (_ForwardIterator) 0x402b8ff4 ----------------- snip ----------------- The type 'ForwardIterator' is wrong, should be (foo *) -- Summary: Wrong type reported by gdb Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: andre dot poenitz at nokia dot com GCC build triplet: i486-linux-gnu GCC host triplet: i486-linux-gnu GCC target triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45465