|| VAR_OR_FUNCTION_DECL_P (decl)
|| TREE_CODE (decl) == FIELD_DECL
|| TREE_CODE (decl) == CONST_DECL
- || objc_method_decl (TREE_CODE (decl)))
+ || objc_method_decl (TREE_CODE (decl))
+ || TREE_CODE (decl) == CONCEPT_DECL)
TREE_DEPRECATED (decl) = 1;
else if (TREE_CODE (decl) == LABEL_DECL)
{
MARK_TS_EXP (FOR_STMT);
MARK_TS_EXP (SWITCH_STMT);
MARK_TS_EXP (WHILE_STMT);
+
+ MARK_TS_DECL_COMMON (CONCEPT_DECL);
}
/* Build a user-defined numeric literal out of an integer constant type VALUE
SWITCH_STMT_SCOPE, respectively. */
DEFTREECODE (SWITCH_STMT, "switch_stmt", tcc_statement, 4)
+/* Extensions for C++ Concepts. */
+
+/* Concept definition. This is not entirely different than a VAR_DECL
+ except that a) it must be a template, and b) doesn't have the wide
+ range of value and linkage options available to variables. Used
+ by C++ FE and in c-family attribute handling. */
+DEFTREECODE (CONCEPT_DECL, "concept_decl", tcc_declaration, 0)
+
/*
Local variables:
mode:c
{
gcc_assert (standard_concept_p (tmpl));
gcc_assert (TREE_CODE (tmpl) == TEMPLATE_DECL);
+ if (TREE_DEPRECATED (DECL_TEMPLATE_RESULT (tmpl)))
+ warn_deprecated_use (DECL_TEMPLATE_RESULT (tmpl), NULL_TREE);
tree parms = INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (tmpl));
args = coerce_template_parms (parms, args, tmpl, complain);
if (args == error_mark_node)
/* New decls. */
MARK_TS_DECL_COMMON (TEMPLATE_DECL);
MARK_TS_DECL_COMMON (WILDCARD_DECL);
- MARK_TS_DECL_COMMON (CONCEPT_DECL);
MARK_TS_DECL_NON_COMMON (USING_DECL);
/* Extensions for Concepts. */
-/* Concept definition. This is not entirely different than a VAR_DECL
- except that a) it must be a template, and b) doesn't have the wide
- range of value and linkage options available to variables. */
-DEFTREECODE (CONCEPT_DECL, "concept_decl", tcc_declaration, 0)
-
/* Used to represent information associated with constrained declarations. */
DEFTREECODE (CONSTRAINT_INFO, "constraint_info", tcc_exceptional, 0)
extern cp_expr finish_constraint_or_expr (location_t, cp_expr, cp_expr);
extern cp_expr finish_constraint_and_expr (location_t, cp_expr, cp_expr);
extern cp_expr finish_constraint_primary_expr (cp_expr);
-extern tree finish_concept_definition (cp_expr, tree);
+extern tree finish_concept_definition (cp_expr, tree, tree);
extern tree combine_constraint_expressions (tree, tree);
extern tree append_constraint (tree, tree);
extern tree get_constraints (const_tree);
return NULL_TREE;
}
+ tree attrs = cp_parser_attributes_opt (parser);
+
if (!cp_parser_require (parser, CPP_EQ, RT_EQ))
{
cp_parser_skip_to_end_of_statement (parser);
but continue as if it were. */
cp_parser_consume_semicolon_at_end_of_statement (parser);
- return finish_concept_definition (id, init);
+ return finish_concept_definition (id, init, attrs);
}
// -------------------------------------------------------------------------- //
the TEMPLATE_DECL. */
tree
-finish_concept_definition (cp_expr id, tree init)
+finish_concept_definition (cp_expr id, tree init, tree attrs)
{
gcc_assert (identifier_p (id));
gcc_assert (processing_template_decl);
DECL_CONTEXT (decl) = current_scope ();
DECL_INITIAL (decl) = init;
+ if (attrs)
+ cplus_decl_attributes (&decl, attrs, 0);
+
set_originating_module (decl, false);
/* Push the enclosing template. */
--- /dev/null
+// DR 2428
+// { dg-do compile { target c++20 } }
+
+template<typename T>
+concept C1 [[deprecated]] = true;
+
+template<typename T>
+concept C2 __attribute__((deprecated)) = false;
+
+template<typename T>
+concept C3 [[deprecated]] = true;
+
+template<typename T>
+concept C4 __attribute__((deprecated)) = false;
+
+static_assert(C3<int>); // { dg-warning "'C3' is deprecated" }
+static_assert(C4<int>); // { dg-error "static assertion failed" }
+ // { dg-warning "'C4' is deprecated" "" { target *-*-* } .-1 }
+
+template<typename T>
+ requires C3<T> // { dg-warning "'C3' is deprecated" }
+int fn1(T t) { return 0; }