template <int I> struct S { int f(int i = I) { return i; } }; void g () { S<(int)0.> a2; }
is valid code - floating-point literals immediately cast to integral types are valid in integral constant expressions - but GCC (4.0/4.1) wrongly rejects it with -ansi -pedantic-errors. Mark has asked for this bug to be assigned to him. -- Summary: [4.0/4.1 Regression] Floating-point literals cast to integral types should be accepted in integer constant expressions Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: mark at codesourcery dot com ReportedBy: jsm28 at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23841