===================================================================
@@ -4840,8 +4840,10 @@ cp_parser_primary_expression (cp_parser *parser,
cast is to an integral or enumeration type will be
checked at that point. If we are not within a cast, then
this code is invalid. */
- if (!cast_p)
- cp_parser_non_integral_constant_expression (parser, NIC_FLOAT);
+ if (!cast_p && !parser->allow_non_integral_constant_expression_p)
+ pedwarn (input_location, OPT_Wpedantic,
+ "ISO C++ forbids using a floating-point literal in a "
+ "constant-expression");
}
return cp_expr (token->u.value, token->location);
===================================================================
@@ -0,0 +1,6 @@
+// PR c++/55080
+// { dg-options "-std=c++98 -pedantic" }
+
+class B {
+ static const int c = 3.1415926; // { dg-warning "constant-expression" }
+};