You can't use a typedef from a typename scope in a template
This is obviously a major bug and it means you can't access the typedefs of the
ISO standard library containers in order to use safe types to manipulate those
containers, when typename is such a container.
Here is the output of the command g++ bug_report_typedef.cc
bug_report_typedef.cc: In function âvoid f(T)â:
bug_report_typedef.cc:3: error: expected â;â before âiâ
g++ -v follows the source code of bug_report_typedef.cc
template <typename T>
void f(T t){
T::type i;
}
g++ -v bug_report_typedef.cc
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.4-3'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--enable-multiarch --enable-linker-build-id --with-system-zlib
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc
--with-arch-32=i486 --with-tune=generic --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.4 (Debian 4.4.4-3)
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic'
/usr/lib/gcc/x86_64-linux-gnu/4.4.4/cc1plus -quiet -v -D_GNU_SOURCE
bug_report_typedef.cc -quiet -dumpbase bug_report_typedef.cc -mtune=generic
-auxbase bug_report_typedef -version -o /tmp/ccgt4Dk8.s
GNU C++ (Debian 4.4.4-3) version 4.4.4 (x86_64-linux-gnu)
compiled by GNU C version 4.4.4, GMP version 4.3.2, MPFR version
2.4.2-p1.
GGC heuristics: --param ggc-min-expand=57 --param ggc-min-heapsize=51739
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/4.4.4/../../../../x86_64-linux-gnu/include"
ignoring nonexistent directory "/usr/include/x86_64-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/4.4
/usr/include/c++/4.4/x86_64-linux-gnu
/usr/include/c++/4.4/backward
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/4.4.4/include
/usr/lib/gcc/x86_64-linux-gnu/4.4.4/include-fixed
/usr/include
End of search list.
GNU C++ (Debian 4.4.4-3) version 4.4.4 (x86_64-linux-gnu)
compiled by GNU C version 4.4.4, GMP version 4.3.2, MPFR version
2.4.2-p1.
GGC heuristics: --param ggc-min-expand=57 --param ggc-min-heapsize=51739
Compiler executable checksum: a92c574e76687c18572fdbea97434cec
bug_report_typedef.cc: In function âvoid f(T)â:
bug_report_typedef.cc:3: error: expected â;â before âiâ
--
Summary: you can't use a typedef from a typename scope in a
template
Product: gcc
Version: 4.4.4
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gcc at razorcam dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44559