+2018-04-04 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ PR c++/65923
+ * decl.c (grokfndecl): Handle standard UDL diagnostics here..
+ * parser.c (cp_parser_unqualified_id): ..not here.
+
2018-04-04 Alexandre Oliva <aoliva@redhat.com>
PR c++/84943
warning (0, "floating point suffix %qs"
" shadowed by implementation", suffix);
}
+ /* 17.6.3.3.5 */
+ if (suffix[0] != '_'
+ && !in_system_header_at (DECL_SOURCE_LOCATION (decl))
+ && !current_function_decl && !(friendp && !funcdef_flag))
+ warning (OPT_Wliteral_suffix,
+ "literal operator suffixes not preceded by %<_%>"
+ " are reserved for future standardization");
}
else
{
/* If that didn't work, try a conversion-function-id. */
if (!cp_parser_parse_definitely (parser))
id = cp_parser_conversion_function_id (parser);
- else if (UDLIT_OPER_P (id))
- {
- /* 17.6.3.3.5 */
- const char *name = UDLIT_OP_SUFFIX (id);
- if (name[0] != '_' && !in_system_header_at (input_location)
- && declarator_p)
- warning (OPT_Wliteral_suffix,
- "literal operator suffixes not preceded by %<_%>"
- " are reserved for future standardization");
- }
return id;
}
--- /dev/null
+// { dg-do compile { target c++14 } }
+
+#include <chrono>
+
+using std::literals::chrono_literals::operator""s;
+
+struct X
+{
+ friend constexpr std::chrono::duration<long double> std::literals::chrono_literals::operator""s(long double);
+};
+
+struct X2
+{
+ friend constexpr X operator""foo(long double) {return {};} // { dg-warning "literal operator suffixes not preceded" }
+};
+
+namespace std
+{
+ template<> void swap(X&, X&)
+ {
+ constexpr std::chrono::duration<long double> operator""s(long double);
+ }
+}