PR c++/69523 make -Wliteral-suffix control warning
authorJonathan Wakely <redi@gcc.gnu.org>
Sun, 19 Feb 2017 14:13:53 +0000 (14:13 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Sun, 19 Feb 2017 14:13:53 +0000 (14:13 +0000)
gcc:

PR c++/69523
* doc/invoke.texi (C++ Dialect Options) [-Wliteral-suffix]: Update
description.

gcc/cp:

2017-02-19  Eric Fiselier  <eric@efcs.ca>
    Jonathan Wakely  <jwakely@redhat.com>

PR c++/69523
* parser.c (cp_parser_unqualified_id): Use OPT_Wliteral_suffix to
control warning about literal suffix identifiers without a leading
underscore.

gcc/testsuite:

2017-02-19  Eric Fiselier  <eric@efcs.ca>
    Jonathan Wakely  <jwakely@redhat.com>

PR c++/69523
* g++.dg/cpp0x/Wliteral-suffix2.C: New test.

From-SVN: r245574

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/Wliteral-suffix2.C [new file with mode: 0644]

index 4b7bc561707c8f9c4d8383f53134b39ad8009c7c..d404f8f3e4834c3a72777ed9fddb36e052d28b29 100644 (file)
@@ -1,3 +1,9 @@
+2017-02-19  Jonathan Wakely  <jwakely@redhat.com>
+
+       PR c++/69523
+       * doc/invoke.texi (C++ Dialect Options) [-Wliteral-suffix]: Update
+       description.
+
 2017-02-19  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
 
        * gimple-pretty-print.c (dump_ternary_rhs): Adjust gimple dump format
index 8dce6d18feaab08688d87279b770795f64b98d4b..d0803bfa433b86f0d025d6888e1135b4df21a0c5 100644 (file)
@@ -1,3 +1,11 @@
+2017-02-19  Eric Fiselier  <eric@efcs.ca>
+           Jonathan Wakely  <jwakely@redhat.com>
+
+       PR c++/69523
+       * parser.c (cp_parser_unqualified_id): Use OPT_Wliteral_suffix to
+       control warning about literal suffix identifiers without a leading
+       underscore.
+
 2017-02-17  Jason Merrill  <jason@redhat.com>
 
        PR c++/79508 - lookup error with member template
index 92d8ccea95bbf46aaf1bab037f661905c117f1cd..feeafcec6ad21c37b4e86db5b3b4fb07d14792d0 100644 (file)
@@ -5812,8 +5812,9 @@ cp_parser_unqualified_id (cp_parser* parser,
              const char *name = UDLIT_OP_SUFFIX (id);
              if (name[0] != '_' && !in_system_header_at (input_location)
                  && declarator_p)
-               warning (0, "literal operator suffixes not preceded by %<_%>"
-                           " are reserved for future standardization");
+               warning (OPT_Wliteral_suffix,
+                        "literal operator suffixes not preceded by %<_%>"
+                        " are reserved for future standardization");
            }
 
          return id;
index c65086cb3a8b2f048307b7d459d84cb76f598537..6e219dab4d326669870d33414be877f295b085b1 100644 (file)
@@ -2852,6 +2852,11 @@ int main() @{
 
 In this case, @code{PRId64} is treated as a separate preprocessing token.
 
+Additionally, warn when a user-defined literal operator is declared with
+a literal suffix identifier that doesn't begin with an underscore. Literal
+suffix identifiers that don't begin with an underscore are reserved for
+future standardization.
+
 This warning is enabled by default.
 
 @item -Wlto-type-mismatch
index 97f392a1ac66d890e4c582371e247a02bcbb2a32..c98d77481c6e4258985d67afb9502f271444281a 100644 (file)
@@ -1,3 +1,9 @@
+2017-02-19  Eric Fiselier  <eric@efcs.ca>
+           Jonathan Wakely  <jwakely@redhat.com>
+
+       PR c++/69523
+       * g++.dg/cpp0x/Wliteral-suffix2.C: New test.
+
 2017-02-19  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
 
        * gcc.dg/gimplefe-26.c: New test.
diff --git a/gcc/testsuite/g++.dg/cpp0x/Wliteral-suffix2.C b/gcc/testsuite/g++.dg/cpp0x/Wliteral-suffix2.C
new file mode 100644 (file)
index 0000000..129947d
--- /dev/null
@@ -0,0 +1,11 @@
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wno-literal-suffix" }
+
+// Test user-defined literals.
+// Test "-Wno-literal-suffix" suppresses warnings on declaration without
+// leading underscore.
+
+long double operator"" nounder(long double); // { dg-bogus "" }
+
+template<char...>
+  int operator"" nounder(); // { dg-bogus "" }