Testcase: template<typename _Tp> struct __per_type_pool_policy { static void _S_get_pool() { const static int __align = (__alignof__(_Tp) >= 1 ? __alignof__(_Tp) : 1); static int _S_tune( 2 >= __align ? 1 : __align); } }; This did not ICE in 4.0.0. Also this is reduced from PR 23352 but I was trying to reduce a different ICE when finding with this one.
*** Bug 23481 has been marked as a duplicate of this bug. ***
Confirmed. Similar testcase from PR 23481: ========================================================= template<typename T> bool foo() { const long int i = sizeof(T) > 1 ? sizeof(T) : 0; return i > 0; } =========================================================
It worked with "4.1.0 20050622".
The testcase starts failing with this patch from pinskia: http://gcc.gnu.org/ml/gcc-cvs/2005-08/msg00068.html
This is more of the issue for a front-end person, mainly why are we calling convert_to_integer while in a template since that assumes all the types are set up correctly.
Subject: Bug 23357 CVSROOT: /cvs/gcc Module name: gcc Changes by: jason@gcc.gnu.org 2005-09-16 06:50:57 Modified files: gcc/cp : ChangeLog cp-tree.def Added files: gcc/testsuite/g++.dg/template: sizeof10.C Log message: PR c++/23357 * cp-tree.def (SIZEOF_EXPR, ALIGNOF_EXPR): Change code class to tcc_expression. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4894&r2=1.4895 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.def.diff?cvsroot=gcc&r1=1.109&r2=1.110 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/sizeof10.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Fixed.