Testcase only in 64bit mode where sizeof (long) != sizeof(int): struct c { int t; int y; c(); }; template <typename T> T * allocbuf (unsigned long size) { return new T[size]; } c * a = allocbuf<c>(10); See PR 22368 for the patch to detect this.
Oh, this has nothing to do with templates at all, reduced further: struct c { int t; int y; c(); }; c * allocbuf (unsigned long size) { return new c[size]; }
Another testcase: struct QRgbMap { QRgbMap(); }; void convert_32_to_8() { QRgbMap table[10]; }
Confirmed: t.cc:14: error: types mismatch in comparsion long intD.5 intD.2 D.1753 != -1;
Even further reduced testcase: struct _Words {_Words();}; _Words _M_local_word[2]; --- This shows up while bootstrapping on x86_64-pc-linux-gnu.
Subject: Bug 22487 Author: rguenth Date: Fri Nov 4 09:46:43 2005 New Revision: 106487 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=106487 Log: 2005-11-04 Richard Guenther <rguenther@suse.de> PR c++/22487 * init.c (build_vec_init): Build comparison of matching types. Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/init.c
Fixed.