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
This commit is contained in:
parent
c80620fcfa
commit
80557bb787
4 changed files with 20 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
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 "
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
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
|
||||
|
|
6
gcc/testsuite/g++.dg/parse/pr55080.C
Normal file
6
gcc/testsuite/g++.dg/parse/pr55080.C
Normal file
|
@ -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" }
|
||||
};
|
Loading…
Add table
Reference in a new issue