diff mbox

[C++,PR57640] Explicit call of system literal operator complains about leading underscore

Message ID 51C98C17.5050009@verizon.net
State New
Headers show

Commit Message

Ed Smith-Rowland June 25, 2013, 12:24 p.m. UTC
This little nit was certainly latent all along but was only exposed once 
we got literal ops into the std library.
A user who calls a operator explicitly get yelled at for not having 
anunderscore.

OK after testing completes on x86_64-linux?

Ed
gcc/cp:

2013-06-25  Ed Smith-Rowland  <3dw4rd@verizon.net>

	PR c++/57640
	* parser.c (cp_parser_unqualified_id): Add declarator_p to checks
	to trigger warning, (cp_literal_operator_id): Remove bogus TODO comment.


gcc/testsuite:

2013-06-25  Ed Smith-Rowland  <3dw4rd@verizon.net>

	PR c++/57640
	* g++.dg/cpp1y/pr57640.C: New.

Comments

Jason Merrill June 25, 2013, 12:50 p.m. UTC | #1
OK.

Jason
diff mbox

Patch

Index: gcc/cp/parser.c
===================================================================
--- gcc/cp/parser.c	(revision 200342)
+++ gcc/cp/parser.c	(working copy)
@@ -5000,7 +4999,7 @@ 
 	    {
 	      /* 17.6.3.3.5  */
 	      const char *name = UDLIT_OP_SUFFIX (id);
-	      if (name[0] != '_' && !in_system_header)
+	      if (name[0] != '_' && !in_system_header && declarator_p)
 		warning (0, "literal operator suffixes not preceded by %<_%>"
 			    " are reserved for future standardization");
 	    }
@@ -12346,7 +12345,6 @@ 
 			      + strlen (name) + 10);
   sprintf (buffer, UDLIT_OP_ANSI_FORMAT, name);
   identifier = get_identifier (buffer);
-  /*IDENTIFIER_UDLIT_OPNAME_P (identifier) = 1; If we get a flag someday. */
 
   return identifier;
 }
Index: gcc/testsuite/g++.dg/cpp1y/pr57640.C
===================================================================
--- gcc/testsuite/g++.dg/cpp1y/pr57640.C	(revision 0)
+++ gcc/testsuite/g++.dg/cpp1y/pr57640.C	(working copy)
@@ -0,0 +1,8 @@ 
+// { dg-options -std=c++1y }
+// { dg-do compile }
+
+#include <chrono>
+
+using namespace std::literals::chrono_literals;
+
+auto blooper = operator"" min(45.0L);