This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] PR c++/65923
- From: Ville Voutilainen <ville dot voutilainen at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org, Jason Merrill <jason at redhat dot com>
- Date: Tue, 3 Apr 2018 17:19:19 +0300
- Subject: [C++ PATCH] PR c++/65923
Finishing testing with the full suite on Linux-PPC64, tested partially
on Linux-x64.
2018-04-03 Ville Voutilainen <ville.voutilainen@gmail.com>
gcc/cp
PR c++/65923
* parser.c (cp_parser_unqualified_id): Add a new parameter
and check it for the literal diagnostic.
(cp_parser_using_declaration): Adjust.
testsuite/
PR c++/65923
* g++.dg/diagnostic/pr65923.C: New.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index d526a4e..677ad61 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -2033,7 +2033,7 @@ static cp_expr cp_parser_primary_expression
static cp_expr cp_parser_id_expression
(cp_parser *, bool, bool, bool *, bool, bool);
static cp_expr cp_parser_unqualified_id
- (cp_parser *, bool, bool, bool, bool);
+ (cp_parser *, bool, bool, bool, bool, bool = false);
static tree cp_parser_nested_name_specifier_opt
(cp_parser *, bool, bool, bool, bool, bool = false);
static tree cp_parser_nested_name_specifier
@@ -5822,7 +5822,8 @@ cp_parser_unqualified_id (cp_parser* parser,
bool template_keyword_p,
bool check_dependency_p,
bool declarator_p,
- bool optional_p)
+ bool optional_p,
+ bool using_decl_p)
{
cp_token *token;
@@ -6105,7 +6106,7 @@ cp_parser_unqualified_id (cp_parser* parser,
/* 17.6.3.3.5 */
const char *name = UDLIT_OP_SUFFIX (id);
if (name[0] != '_' && !in_system_header_at (input_location)
- && declarator_p)
+ && declarator_p && !using_decl_p)
warning (OPT_Wliteral_suffix,
"literal operator suffixes not preceded by %<_%>"
" are reserved for future standardization");
@@ -18775,7 +18776,8 @@ cp_parser_using_declaration (cp_parser* parser,
/*template_keyword_p=*/false,
/*check_dependency_p=*/true,
/*declarator_p=*/true,
- /*optional_p=*/false);
+ /*optional_p=*/false,
+ /*using_decl_p=*/true);
if (access_declaration_p)
{
diff --git a/gcc/testsuite/g++.dg/diagnostic/pr65923.C b/gcc/testsuite/g++.dg/diagnostic/pr65923.C
new file mode 100644
index 0000000..b9584d0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/pr65923.C
@@ -0,0 +1,5 @@
+// { dg-do compile { target c++14 } }
+
+#include <chrono>
+
+using std::literals::chrono_literals::operator""s; // warning here