This doesn't work: g++-4.3.1 These work: g++-3.4.6 g++-4.1.2 g++-4.2.4 $ g++-4.3.1 -v Using built-in specs. Target: x86_64-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-4.3.1-r1/work/gcc-4.3.1/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.3.1 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.1/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.3.1 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.3.1/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.3.1/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.1/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --enable-multilib --enable-libmudflap --disable-libssp --enable-cld --enable-java-awt=gtk --enable-objc-gc --enable-languages=c,c++,java,objc,obj-c++,treelang,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.3.1-r1 p1.1' Thread model: posix gcc version 4.3.1 (Gentoo 4.3.1-r1 p1.1)
Same results in 4.3.1 with -O2/-O0 and with/without -m32. I get the size of unsigned, instead of the size of mode(*I). --- extern "C" void abort(); template<class unused> void function() { typedef unsigned uint8_t __attribute__((mode(QI))); typedef unsigned uint16_t __attribute__((mode(HI))); typedef unsigned uint32_t __attribute__((mode(SI))); typedef unsigned uint64_t __attribute__((mode(DI))); //typedef unsigned uint128_t __attribute__((mode(TI))); if(sizeof(uint8_t) != sizeof((uint8_t)0) || sizeof(uint16_t) != sizeof((uint16_t)0) || sizeof(uint32_t) != sizeof((uint32_t)0) || sizeof(uint64_t) != sizeof((uint64_t)0) ) abort(); } int main() { function<char>(); } -- Summary: 'sizeof' wrong when using typedef ... __attribute__((mode(*I))) in a template Product: gcc Version: 4.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: cyp561 at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36979