struct foo
{
static const float bar = 1.2;
};
is accepted without a warning. It is rejected with -pedantic.
from cp/decl.c:
else if (pedantic && !INTEGRAL_TYPE_P (type))
pedwarn ("ISO C++ forbids initialization of member constant "
"%qD of non-integral type %qT", decl, type);
why do we guard the pedwarn with if (pedantic)??
--
Summary: initialization of non-integral member constant not
rejected
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: accepts-invalid, diagnostic
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rguenth at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33750