Commit 80557bb7 by Paolo Carlini Committed by Paolo Carlini

re PR c++/55080 (-pedantic produces error: floating-point literal cannot appear…

re PR c++/55080 (-pedantic produces error: floating-point literal cannot appear in a constant-expression)

/cp
2016-11-17  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/55080
	* parser.c (cp_parser_non_integral_constant_expression): Issue a
	pedwarn instead of an error for case NIC_FLOAT.

/testsuite
2016-11-17  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/55080
	* g++.dg/parse/pr55080.C: New.

From-SVN: r242565
parent c80620fc
2016-11-17 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/55080
* parser.c (cp_parser_non_integral_constant_expression): Issue a
pedwarn instead of an error for case NIC_FLOAT.
2016-11-17 Jason Merrill <jason@redhat.com>
PR c++/78124 - list-initialization and inherited ctor
......
......@@ -3028,8 +3028,9 @@ cp_parser_non_integral_constant_expression (cp_parser *parser,
switch (thing)
{
case NIC_FLOAT:
error ("floating-point literal "
"cannot appear in a constant-expression");
pedwarn (input_location, OPT_Wpedantic,
"ISO C++ forbids using a floating-point literal "
"in a constant-expression");
return true;
case NIC_CAST:
error ("a cast to a type other than an integral or "
2016-11-17 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/55080
* g++.dg/parse/pr55080.C: New.
2016-11-17 Michael Meissner <meissner@linux.vnet.ibm.com>
PR target/78101
......
// PR c++/55080
// { dg-options "-std=c++98 -pedantic" }
class B {
static const int c = 3.1415926; // { dg-warning "constant-expression" }
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment