diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2016-11-17 21:44:05 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2016-11-17 21:44:05 +0000 |
commit | 80557bb787a65fb5b7a65d14ccabe6e962f88079 (patch) | |
tree | 4a94aa82d8e23bef51b7cc23fea6e0a4a94fd601 /gcc | |
parent | c80620fcfa577f25449c727758627f47224cfaf9 (diff) | |
download | gcc-80557bb787a65fb5b7a65d14ccabe6e962f88079.zip gcc-80557bb787a65fb5b7a65d14ccabe6e962f88079.tar.gz gcc-80557bb787a65fb5b7a65d14ccabe6e962f88079.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/parser.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/pr55080.C | 6 |
4 files changed, 20 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 24564ec..3178c1f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 3ab0b68..9da4b30 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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 " diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8018587..ed6b9a7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 diff --git a/gcc/testsuite/g++.dg/parse/pr55080.C b/gcc/testsuite/g++.dg/parse/pr55080.C new file mode 100644 index 0000000..b66395a --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/pr55080.C @@ -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" } +}; |