/* Definitions for C++ parsing and type checking.
- Copyright (C) 1987-2019 Free Software Foundation, Inc.
+ Copyright (C) 1987-2020 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GCC.
CPTI_PFN_IDENTIFIER,
CPTI_VPTR_IDENTIFIER,
CPTI_GLOBAL_IDENTIFIER,
- CPTI_STD_IDENTIFIER,
CPTI_ANON_IDENTIFIER,
CPTI_AUTO_IDENTIFIER,
CPTI_DECLTYPE_AUTO_IDENTIFIER,
CPTI_VALUE_IDENTIFIER,
CPTI_FUN_IDENTIFIER,
CPTI_CLOSURE_IDENTIFIER,
+ CPTI_HEAP_UNINIT_IDENTIFIER,
+ CPTI_HEAP_IDENTIFIER,
+ CPTI_HEAP_DELETED_IDENTIFIER,
CPTI_LANG_NAME_C,
CPTI_LANG_NAME_CPLUSPLUS,
CPTI_ANY_TARG,
+ CPTI_SOURCE_LOCATION_IMPL,
+
CPTI_MAX
};
then deletes the entire object. */
#define deleting_dtor_identifier cp_global_trees[CPTI_DELETING_DTOR_IDENTIFIER]
-#define ovl_op_identifier(ISASS, CODE) (OVL_OP_INFO(ISASS, CODE)->identifier)
-#define assign_op_identifier (ovl_op_info[true][OVL_OP_NOP_EXPR].identifier)
-#define call_op_identifier (ovl_op_info[false][OVL_OP_CALL_EXPR].identifier)
/* The name used for conversion operators -- but note that actual
conversion functions use special identifiers outside the identifier
table. */
#define vptr_identifier cp_global_trees[CPTI_VPTR_IDENTIFIER]
/* The name of the ::, std & anon namespaces. */
#define global_identifier cp_global_trees[CPTI_GLOBAL_IDENTIFIER]
-#define std_identifier cp_global_trees[CPTI_STD_IDENTIFIER]
#define anon_identifier cp_global_trees[CPTI_ANON_IDENTIFIER]
/* auto and declspec(auto) identifiers. */
#define auto_identifier cp_global_trees[CPTI_AUTO_IDENTIFIER]
#define value_identifier cp_global_trees[CPTI_VALUE_IDENTIFIER]
#define fun_identifier cp_global_trees[CPTI_FUN_IDENTIFIER]
#define closure_identifier cp_global_trees[CPTI_CLOSURE_IDENTIFIER]
+#define heap_uninit_identifier cp_global_trees[CPTI_HEAP_UNINIT_IDENTIFIER]
+#define heap_identifier cp_global_trees[CPTI_HEAP_IDENTIFIER]
+#define heap_deleted_identifier cp_global_trees[CPTI_HEAP_DELETED_IDENTIFIER]
#define lang_name_c cp_global_trees[CPTI_LANG_NAME_C]
#define lang_name_cplusplus cp_global_trees[CPTI_LANG_NAME_CPLUSPLUS]
/* A node which matches any template argument. */
#define any_targ_node cp_global_trees[CPTI_ANY_TARG]
+/* std::source_location::__impl class. */
+#define source_location_impl cp_global_trees[CPTI_SOURCE_LOCATION_IMPL]
+
/* Node to indicate default access. This must be distinct from the
access nodes in tree.h. */
LAMBDA_EXPR_MUTABLE_P (in LAMBDA_EXPR)
DECL_FINAL_P (in FUNCTION_DECL)
QUALIFIED_NAME_IS_TEMPLATE (in SCOPE_REF)
- DECLTYPE_FOR_INIT_CAPTURE (in DECLTYPE_TYPE)
+ CONSTRUCTOR_IS_DEPENDENT (in CONSTRUCTOR)
TINFO_USED_TEMPLATE_ID (in TEMPLATE_INFO)
PACK_EXPANSION_SIZEOF_P (in *_PACK_EXPANSION)
OVL_USING_P (in OVERLOAD)
OVL_HIDDEN_P (in OVERLOAD)
SWITCH_STMT_NO_BREAK_P (in SWITCH_STMT)
LAMBDA_EXPR_CAPTURE_OPTIMIZED (in LAMBDA_EXPR)
+ IMPLICIT_CONV_EXPR_BRACED_INIT (in IMPLICIT_CONV_EXPR)
+ TINFO_VAR_DECLARED_CONSTINIT (in TEMPLATE_INFO)
+ CALL_FROM_NEW_OR_DELETE_P (in CALL_EXPR)
3: (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out).
ICS_BAD_FLAG (in _CONV)
FN_TRY_BLOCK_P (in TRY_BLOCK)
BIND_EXPR_BODY_BLOCK (in BIND_EXPR)
- DECL_NONTRIVIALLY_INITIALIZED_P (in VAR_DECL)
CALL_EXPR_ORDERED_ARGS (in CALL_EXPR, AGGR_INIT_EXPR)
DECLTYPE_FOR_REF_CAPTURE (in DECLTYPE_TYPE)
CONSTRUCTOR_C99_COMPOUND_LITERAL (in CONSTRUCTOR)
OVL_NESTED_P (in OVERLOAD)
+ LAMBDA_EXPR_INSTANTIATED (in LAMBDA_EXPR)
+ Reserved for DECL_MODULE_EXPORT (in DECL_)
4: IDENTIFIER_MARKED (IDENTIFIER_NODEs)
TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
CALL_EXPR, or FIELD_DECL).
OVL_LOOKUP_P (in OVERLOAD)
LOOKUP_FOUND_P (in RECORD_TYPE, UNION_TYPE, NAMESPACE_DECL)
5: IDENTIFIER_VIRTUAL_P (in IDENTIFIER_NODE)
- DECL_VTABLE_OR_VTT_P (in VAR_DECL)
FUNCTION_RVALUE_QUALIFIED (in FUNCTION_TYPE, METHOD_TYPE)
CALL_EXPR_REVERSE_ARGS (in CALL_EXPR, AGGR_INIT_EXPR)
CONSTRUCTOR_PLACEHOLDER_BOUNDARY (in CONSTRUCTOR)
- 6: IDENTIFIER_REPO_CHOSEN (in IDENTIFIER_NODE)
- DECL_CONSTRUCTION_VTABLE_P (in VAR_DECL)
- TYPE_MARKED_P (in _TYPE)
+ 6: TYPE_MARKED_P (in _TYPE)
+ DECL_NON_TRIVIALLY_INITIALIZED_P (in VAR_DECL)
RANGE_FOR_IVDEP (in RANGE_FOR_STMT)
CALL_EXPR_OPERATOR_SYNTAX (in CALL_EXPR, AGGR_INIT_EXPR)
+ CONSTRUCTOR_IS_DESIGNATED_INIT (in CONSTRUCTOR)
Usage of TYPE_LANG_FLAG_?:
0: TYPE_DEPENDENT_P
5: CLASS_TYPE_P (in RECORD_TYPE and UNION_TYPE)
ENUM_FIXED_UNDERLYING_TYPE_P (in ENUMERAL_TYPE)
AUTO_IS_DECLTYPE (in TEMPLATE_TYPE_PARM)
- REFERENCE_VLA_OK (in REFERENCE_TYPE)
6: TYPE_DEPENDENT_P_VALID
Usage of DECL_LANG_FLAG_?:
TREE_CHECK(NODE,BOUND_TEMPLATE_TEMPLATE_PARM)
#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
+
+/* Returns t iff the node can have a TEMPLATE_INFO field. */
+
+inline tree
+template_info_decl_check (const_tree t, const char* f, int l, const char* fn)
+{
+ switch (TREE_CODE (t))
+ {
+ case VAR_DECL:
+ case FUNCTION_DECL:
+ case FIELD_DECL:
+ case TYPE_DECL:
+ case CONCEPT_DECL:
+ case TEMPLATE_DECL:
+ return const_cast<tree>(t);
+ default:
+ break;
+ }
+ tree_check_failed (t, f, l, fn,
+ VAR_DECL, FUNCTION_DECL, FIELD_DECL, TYPE_DECL,
+ CONCEPT_DECL, TEMPLATE_DECL, 0);
+ gcc_unreachable ();
+}
+
+#define TEMPLATE_INFO_DECL_CHECK(NODE) \
+ template_info_decl_check ((NODE), __FILE__, __LINE__, __FUNCTION__)
+
#define THUNK_FUNCTION_CHECK(NODE) __extension__ \
({ __typeof (NODE) const __t = (NODE); \
if (TREE_CODE (__t) != FUNCTION_DECL || !__t->decl_common.lang_specific \
|| !__t->decl_common.lang_specific->u.fn.thunk_p) \
tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \
__t; })
-#else
+
+#else /* ENABLE_TREE_CHECKING */
+
+#define TEMPLATE_INFO_DECL_CHECK(NODE) (NODE)
#define THUNK_FUNCTION_CHECK(NODE) (NODE)
-#endif
+
+#endif /* ENABLE_TREE_CHECKING */
\f
/* Language-dependent contents of an identifier. */
/* Iterator for a 1 dimensional overload. Permits iterating over the
outer level of a 2-d overload when explicitly enabled. */
-class ovl_iterator
+class ovl_iterator
{
tree ovl;
const bool allow_inner; /* Only used when checking. */
/* Whether this overload was introduced by a using decl. */
bool using_p () const
{
- return TREE_CODE (ovl) == OVERLOAD && OVL_USING_P (ovl);
+ return (TREE_CODE (ovl) == USING_DECL
+ || (TREE_CODE (ovl) == OVERLOAD && OVL_USING_P (ovl)));
}
bool hidden_p () const
{
/* Simplified unique_ptr clone to release a tree vec on exit. */
-struct releasing_vec
+class releasing_vec
{
+public:
typedef vec<tree, va_gc> vec_t;
releasing_vec (vec_t *v): v(v) { }
vec_t *operator-> () const { return v; }
vec_t *get() const { return v; }
operator vec_t *() const { return v; }
- tree& operator[] (unsigned i) const { return (*v)[i]; }
+ vec_t ** operator& () { return &v; }
- /* Necessary for use with vec** and vec*& interfaces. */
- vec_t *&get_ref () { return v; }
+ /* Breaks pointer/value consistency for convenience. */
+ tree& operator[] (unsigned i) const { return (*v)[i]; }
~releasing_vec() { release_tree_vector (v); }
private:
vec_t *v;
};
+/* Forwarding functions for vec_safe_* that might reallocate. */
+inline tree* vec_safe_push (releasing_vec& r, const tree &t CXX_MEM_STAT_INFO)
+{ return vec_safe_push (*&r, t PASS_MEM_STAT); }
+inline bool vec_safe_reserve (releasing_vec& r, unsigned n, bool e = false CXX_MEM_STAT_INFO)
+{ return vec_safe_reserve (*&r, n, e PASS_MEM_STAT); }
+inline unsigned vec_safe_length (releasing_vec &r)
+{ return r->length(); }
+inline void vec_safe_splice (releasing_vec &r, vec<tree, va_gc> *p CXX_MEM_STAT_INFO)
+{ vec_safe_splice (*&r, p PASS_MEM_STAT); }
+void release_tree_vector (releasing_vec &); // cause link error
struct GTY(()) tree_template_decl {
struct tree_decl_common common;
#define IDENTIFIER_VIRTUAL_P(NODE) \
TREE_LANG_FLAG_5 (IDENTIFIER_NODE_CHECK (NODE))
-/* True iff NAME is the DECL_ASSEMBLER_NAME for an entity with vague
- linkage which the prelinker has assigned to this translation
- unit. */
-#define IDENTIFIER_REPO_CHOSEN(NAME) \
- (TREE_LANG_FLAG_6 (IDENTIFIER_NODE_CHECK (NAME)))
-
/* True if this identifier is a reserved word. C_RID_CODE (node) is
then the RID_* value of the keyword. Value 1. */
#define IDENTIFIER_KEYWORD_P(NODE) \
#define C_TYPE_FIELDS_READONLY(TYPE) \
(LANG_TYPE_CLASS_CHECK (TYPE)->fields_readonly)
-/* The tokens stored in the default argument. */
+/* The tokens stored in the unparsed operand. */
-#define DEFARG_TOKENS(NODE) \
- (((struct tree_default_arg *)DEFAULT_ARG_CHECK (NODE))->tokens)
-#define DEFARG_INSTANTIATIONS(NODE) \
- (((struct tree_default_arg *)DEFAULT_ARG_CHECK (NODE))->instantiations)
+#define DEFPARSE_TOKENS(NODE) \
+ (((struct tree_deferred_parse *)DEFERRED_PARSE_CHECK (NODE))->tokens)
+#define DEFPARSE_INSTANTIATIONS(NODE) \
+ (((struct tree_deferred_parse *)DEFERRED_PARSE_CHECK (NODE))->instantiations)
-struct GTY (()) tree_default_arg {
- struct tree_common common;
+struct GTY (()) tree_deferred_parse {
+ struct tree_base base;
struct cp_token_cache *tokens;
vec<tree, va_gc> *instantiations;
};
#define UNEVALUATED_NOEXCEPT_SPEC_P(NODE) \
(DEFERRED_NOEXCEPT_SPEC_P (NODE) \
&& DEFERRED_NOEXCEPT_PATTERN (TREE_PURPOSE (NODE)) == NULL_TREE)
+#define UNPARSED_NOEXCEPT_SPEC_P(NODE) \
+ ((NODE) && (TREE_PURPOSE (NODE)) \
+ && (TREE_CODE (TREE_PURPOSE (NODE)) == DEFERRED_PARSE))
struct GTY (()) tree_deferred_noexcept {
struct tree_base base;
#define TRAIT_EXPR_KIND(NODE) \
(((struct tree_trait_expr *)TRAIT_EXPR_CHECK (NODE))->kind)
+#define TRAIT_EXPR_LOCATION(NODE) \
+ (((struct tree_trait_expr *)TRAIT_EXPR_CHECK (NODE))->locus)
+
struct GTY (()) tree_trait_expr {
struct tree_common common;
tree type1;
- tree type2;
+ tree type2;
+ location_t locus;
enum cp_trait_kind kind;
};
+/* Identifiers used for lambda types are almost anonymous. Use this
+ spare flag to distinguish them (they also have the anonymous flag). */
+#define IDENTIFIER_LAMBDA_P(NODE) \
+ (IDENTIFIER_NODE_CHECK(NODE)->base.protected_flag)
+
/* Based off of TYPE_UNNAMED_P. */
-#define LAMBDA_TYPE_P(NODE) \
- (CLASS_TYPE_P (NODE) && CLASSTYPE_LAMBDA_EXPR (NODE))
+#define LAMBDA_TYPE_P(NODE) \
+ (TREE_CODE (NODE) == RECORD_TYPE \
+ && TYPE_LINKAGE_IDENTIFIER (NODE) \
+ && IDENTIFIER_LAMBDA_P (TYPE_LINKAGE_IDENTIFIER (NODE)))
/* Test if FUNCTION_DECL is a lambda function. */
#define LAMBDA_FUNCTION_P(FNDECL) \
#define LAMBDA_EXPR_CAPTURE_OPTIMIZED(NODE) \
TREE_LANG_FLAG_2 (LAMBDA_EXPR_CHECK (NODE))
+/* True iff this LAMBDA_EXPR was generated in tsubst_lambda_expr. */
+#define LAMBDA_EXPR_INSTANTIATED(NODE) \
+ TREE_LANG_FLAG_3 (LAMBDA_EXPR_CHECK (NODE))
+
/* True if this TREE_LIST in LAMBDA_EXPR_CAPTURE_LIST is for an explicit
capture. */
#define LAMBDA_CAPTURE_EXPLICIT_P(NODE) \
#define TINFO_USED_TEMPLATE_ID(NODE) \
(TREE_LANG_FLAG_1 (TEMPLATE_INFO_CHECK (NODE)))
+/* Non-zero if this variable template specialization was declared with the
+ `constinit' specifier. */
+#define TINFO_VAR_DECLARED_CONSTINIT(NODE) \
+ (TREE_LANG_FLAG_2 (TEMPLATE_INFO_CHECK (NODE)))
+
struct GTY(()) tree_template_info {
- struct tree_common common;
+ struct tree_base base;
+ tree tmpl;
+ tree args;
vec<qualified_typedef_usage_t, va_gc> *typedefs_needing_access_checking;
};
return p;
}
-// Returns true iff T is non-null and represents constraint info.
+/* Returns true iff T is non-null and represents constraint info. */
inline tree_constraint_info *
check_constraint_info (tree t)
{
return NULL;
}
-// Access the expression describing the template constraints. This may be
-// null if no constraints were introduced in the template parameter list,
-// a requirements clause after the template parameter list, or constraints
-// through a constrained-type-specifier.
+/* Access the expression describing the template constraints. This may be
+ null if no constraints were introduced in the template parameter list,
+ a requirements clause after the template parameter list, or constraints
+ through a constrained-type-specifier. */
#define CI_TEMPLATE_REQS(NODE) \
- check_constraint_info (check_nonnull(NODE))->template_reqs
+ check_constraint_info (check_nonnull (NODE))->template_reqs
-// Access the expression describing the trailing constraints. This is non-null
-// for any implicit instantiation of a constrained declaration. For a
-// templated declaration it is non-null only when a trailing requires-clause
-// was specified.
+/* Access the expression describing the trailing constraints. This is non-null
+ for any implicit instantiation of a constrained declaration. For a
+ templated declaration it is non-null only when a trailing requires-clause
+ was specified. */
#define CI_DECLARATOR_REQS(NODE) \
- check_constraint_info (check_nonnull(NODE))->declarator_reqs
+ check_constraint_info (check_nonnull (NODE))->declarator_reqs
-// The computed associated constraint expression for a declaration.
+/* The computed associated constraint expression for a declaration. */
#define CI_ASSOCIATED_CONSTRAINTS(NODE) \
- check_constraint_info (check_nonnull(NODE))->associated_constr
+ check_constraint_info (check_nonnull (NODE))->associated_constr
-// Access the logical constraints on the template parameters introduced
-// at a given template parameter list level indicated by NODE.
+/* Access the constraint-expression introduced by the requires-clause
+ associate the template parameter list NODE. */
#define TEMPLATE_PARMS_CONSTRAINTS(NODE) \
TREE_TYPE (TREE_LIST_CHECK (NODE))
-// Access the logical constraints on the template parameter declaration
-// indicated by NODE.
+/* Access the logical constraints on the template parameter declaration
+ indicated by NODE. */
#define TEMPLATE_PARM_CONSTRAINTS(NODE) \
TREE_TYPE (TREE_LIST_CHECK (NODE))
-/* Non-zero if the noexcept is present in a compound requirement. */
+/* Non-zero if the noexcept is present in a compound requirement. */
#define COMPOUND_REQ_NOEXCEPT_P(NODE) \
TREE_LANG_FLAG_0 (TREE_CHECK (NODE, COMPOUND_REQ))
#define PLACEHOLDER_TYPE_CONSTRAINTS(NODE) \
DECL_SIZE_UNIT (TYPE_NAME (NODE))
-/* The expression evaluated by the predicate constraint. */
-#define PRED_CONSTR_EXPR(NODE) \
- TREE_OPERAND (TREE_CHECK (NODE, PRED_CONSTR), 0)
-
-/* The concept of a concept check. */
-#define CHECK_CONSTR_CONCEPT(NODE) \
- TREE_OPERAND (TREE_CHECK (NODE, CHECK_CONSTR), 0)
-
-/* The template arguments of a concept check. */
-#define CHECK_CONSTR_ARGS(NODE) \
- TREE_OPERAND (TREE_CHECK (NODE, CHECK_CONSTR), 1)
-
-/* The expression validated by the predicate constraint. */
-#define EXPR_CONSTR_EXPR(NODE) \
- TREE_OPERAND (TREE_CHECK (NODE, EXPR_CONSTR), 0)
+/* True if NODE is a constraint. */
+#define CONSTR_P(NODE) \
+ (TREE_CODE (NODE) == ATOMIC_CONSTR \
+ || TREE_CODE (NODE) == CONJ_CONSTR \
+ || TREE_CODE (NODE) == DISJ_CONSTR)
-/* The type validated by the predicate constraint. */
-#define TYPE_CONSTR_TYPE(NODE) \
- TREE_OPERAND (TREE_CHECK (NODE, TYPE_CONSTR), 0)
+/* Valid for any normalized constraint. */
+#define CONSTR_CHECK(NODE) \
+ TREE_CHECK3 (NODE, ATOMIC_CONSTR, CONJ_CONSTR, DISJ_CONSTR)
-/* In an implicit conversion constraint, the source expression. */
-#define ICONV_CONSTR_EXPR(NODE) \
- TREE_OPERAND (TREE_CHECK (NODE, ICONV_CONSTR), 0)
+/* The CONSTR_INFO stores normalization data for a constraint. It refers to
+ the original expression and the expression or declaration
+ from which the constraint was normalized.
-/* In an implicit conversion constraint, the target type. */
-#define ICONV_CONSTR_TYPE(NODE) \
- TREE_OPERAND (TREE_CHECK (NODE, ICONV_CONSTR), 1)
+ This is TREE_LIST whose TREE_PURPOSE is the original expression and whose
+ TREE_VALUE is a list of contexts. */
+#define CONSTR_INFO(NODE) \
+ TREE_TYPE (CONSTR_CHECK (NODE))
-/* In an argument deduction constraint, the source expression. */
-#define DEDUCT_CONSTR_EXPR(NODE) \
- TREE_OPERAND (TREE_CHECK (NODE, DEDUCT_CONSTR), 0)
+/* The expression evaluated by the constraint. */
+#define CONSTR_EXPR(NODE) \
+ TREE_PURPOSE (CONSTR_INFO (NODE))
-/* In an argument deduction constraint, the target type pattern. */
-#define DEDUCT_CONSTR_PATTERN(NODE) \
- TREE_OPERAND (TREE_CHECK (NODE, DEDUCT_CONSTR), 1)
+/* The expression or declaration from which this constraint was normalized.
+ This is a TREE_LIST whose TREE_VALUE is either a template-id expression
+ denoting a concept check or the declaration introducing the constraint.
+ These are chained to other context objects. */
+#define CONSTR_CONTEXT(NODE) \
+ TREE_VALUE (CONSTR_INFO (NODE))
-/* In an argument deduction constraint, the list of placeholder nodes. */
-#define DEDUCT_CONSTR_PLACEHOLDER(NODE) \
- TREE_OPERAND (TREE_CHECK (NODE, DEDUCT_CONSTR), 2)
+/* The parameter mapping for an atomic constraint. */
+#define ATOMIC_CONSTR_MAP(NODE) \
+ TREE_OPERAND (TREE_CHECK (NODE, ATOMIC_CONSTR), 0)
-/* The expression of an exception constraint. */
-#define EXCEPT_CONSTR_EXPR(NODE) \
- TREE_OPERAND (TREE_CHECK (NODE, EXCEPT_CONSTR), 0)
+/* The expression of an atomic constraint. */
+#define ATOMIC_CONSTR_EXPR(NODE) \
+ CONSTR_EXPR (ATOMIC_CONSTR_CHECK (NODE))
-/* In a parameterized constraint, the local parameters. */
-#define PARM_CONSTR_PARMS(NODE) \
- TREE_OPERAND (TREE_CHECK (NODE, PARM_CONSTR), 0)
+/* The concept of a concept check. */
+#define CHECK_CONSTR_CONCEPT(NODE) \
+ TREE_OPERAND (TREE_CHECK (NODE, CHECK_CONSTR), 0)
-/* In a parameterized constraint, the operand. */
-#define PARM_CONSTR_OPERAND(NODE) \
- TREE_OPERAND (TREE_CHECK (NODE, PARM_CONSTR), 1)
+/* The template arguments of a concept check. */
+#define CHECK_CONSTR_ARGS(NODE) \
+ TREE_OPERAND (TREE_CHECK (NODE, CHECK_CONSTR), 1)
/* Whether a PARM_DECL represents a local parameter in a
requires-expression. */
TS_CP_OVERLOAD,
TS_CP_BASELINK,
TS_CP_TEMPLATE_DECL,
- TS_CP_DEFAULT_ARG,
+ TS_CP_DEFERRED_PARSE,
TS_CP_DEFERRED_NOEXCEPT,
TS_CP_STATIC_ASSERT,
TS_CP_ARGUMENT_PACK_SELECT,
struct tree_overload GTY ((tag ("TS_CP_OVERLOAD"))) overload;
struct tree_baselink GTY ((tag ("TS_CP_BASELINK"))) baselink;
struct tree_template_decl GTY ((tag ("TS_CP_TEMPLATE_DECL"))) template_decl;
- struct tree_default_arg GTY ((tag ("TS_CP_DEFAULT_ARG"))) default_arg;
+ struct tree_deferred_parse GTY ((tag ("TS_CP_DEFERRED_PARSE"))) deferred_parse;
struct tree_deferred_noexcept GTY ((tag ("TS_CP_DEFERRED_NOEXCEPT"))) deferred_noexcept;
struct lang_identifier GTY ((tag ("TS_CP_IDENTIFIER"))) identifier;
- struct tree_static_assert GTY ((tag ("TS_CP_STATIC_ASSERT")))
+ struct tree_static_assert GTY ((tag ("TS_CP_STATIC_ASSERT")))
static_assertion;
struct tree_argument_pack_select GTY ((tag ("TS_CP_ARGUMENT_PACK_SELECT")))
argument_pack_select;
int x_processing_template_decl;
int x_processing_specialization;
+ int x_processing_constraint;
+ int suppress_location_wrappers;
BOOL_BITFIELD x_processing_explicit_instantiation : 1;
BOOL_BITFIELD need_pop_function_context : 1;
/* If non-zero, implicit "omp declare target" attribute is added into the
attribute lists. */
int omp_declare_target_attribute;
+ int ref_temp_count;
struct stmt_tree_s x_stmt_tree;
#define in_discarded_stmt scope_chain->discarded_stmt
+#define current_ref_temp_count scope_chain->ref_temp_count
+
/* RAII sentinel to handle clearing processing_template_decl and restoring
it when done. */
-struct processing_template_decl_sentinel
+class processing_template_decl_sentinel
{
+public:
int saved;
processing_template_decl_sentinel (bool reset = true)
: saved (processing_template_decl)
/* RAII sentinel to disable certain warnings during template substitution
and elsewhere. */
-struct warning_sentinel
+class warning_sentinel
{
+public:
int &flag;
int val;
warning_sentinel(int& flag, bool suppress=true)
~warning_sentinel() { flag = val; }
};
+/* RAII sentinel to temporarily override input_location. This will not set
+ input_location to UNKNOWN_LOCATION or BUILTINS_LOCATION. */
+
+class iloc_sentinel
+{
+ location_t saved_loc;
+public:
+ iloc_sentinel (location_t loc): saved_loc (input_location)
+ {
+ if (loc >= RESERVED_LOCATION_COUNT)
+ input_location = loc;
+ }
+ ~iloc_sentinel ()
+ {
+ input_location = saved_loc;
+ }
+};
+
/* RAII sentinel that saves the value of a variable, optionally
overrides it right away, and restores its value when the sentinel
id destructed. */
tree x_in_charge_parm;
tree x_vtt_parm;
tree x_return_value;
- tree x_auto_return_pattern;
BOOL_BITFIELD returns_value : 1;
BOOL_BITFIELD returns_null : 1;
#define current_function_return_value \
(cp_function_chain->x_return_value)
-/* A type involving 'auto' to be used for return type deduction. */
-
-#define current_function_auto_return_pattern \
- (cp_function_chain->x_auto_return_pattern)
-
/* In parser.c. */
extern tree cp_literal_operator_id (const char *);
#define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (TYPE_IDENTIFIER (NODE)))
#define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (TYPE_IDENTIFIER (NODE)))
-/* Nonzero if NODE has no name for linkage purposes. */
-#define TYPE_UNNAMED_P(NODE) \
- (OVERLOAD_TYPE_P (NODE) && anon_aggrname_p (TYPE_LINKAGE_IDENTIFIER (NODE)))
+/* Any kind of anonymous type. */
+#define TYPE_ANON_P(NODE) \
+ (TYPE_LINKAGE_IDENTIFIER (NODE) \
+ && IDENTIFIER_ANON_P (TYPE_LINKAGE_IDENTIFIER (NODE)))
+
+/* Nonzero if NODE, a TYPE, has no name for linkage purposes. */
+#define TYPE_UNNAMED_P(NODE) \
+ (TYPE_ANON_P (NODE) \
+ && !IDENTIFIER_LAMBDA_P (TYPE_LINKAGE_IDENTIFIER (NODE)))
/* The _DECL for this _TYPE. */
#define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE)))
unsigned fields_readonly : 1;
unsigned ptrmemfunc_flag : 1;
- unsigned was_anonymous : 1;
unsigned lazy_default_ctor : 1;
unsigned lazy_copy_ctor : 1;
unsigned lazy_copy_assign : 1;
unsigned has_const_copy_ctor : 1;
unsigned has_complex_copy_ctor : 1;
unsigned has_complex_copy_assign : 1;
-
unsigned non_aggregate : 1;
+
unsigned has_complex_dflt : 1;
unsigned has_list_ctor : 1;
unsigned non_std_layout : 1;
unsigned lazy_move_ctor : 1;
unsigned lazy_move_assign : 1;
unsigned has_complex_move_ctor : 1;
-
unsigned has_complex_move_assign : 1;
+
unsigned has_constexpr_ctor : 1;
unsigned unique_obj_representations : 1;
unsigned unique_obj_representations_set : 1;
/* There are some bits left to fill out a 32-bit word. Keep track
of this by updating the size of this bitfield whenever you add or
remove a flag. */
- unsigned dummy : 4;
+ unsigned dummy : 5;
tree primary_base;
vec<tree_pair_s, va_gc> *vcall_indices;
unsigned use_template : 2;
unsigned not_really_extern : 1; /* var or fn */
unsigned initialized_in_class : 1; /* var or fn */
- unsigned repo_available_p : 1; /* var or fn */
unsigned threadprivate_or_deleted_p : 1; /* var or fn */
unsigned anticipated_p : 1; /* fn, type or template */
/* anticipated_p reused as DECL_OMP_PRIVATIZED_MEMBER in var */
unsigned concept_p : 1; /* applies to vars and functions */
unsigned var_declared_inline_p : 1; /* var */
unsigned dependent_init_p : 1; /* var */
- /* 1 spare bit */
+ /* 2 spare bits */
};
/* True for DECL codes which have template info and access. */
|| TREE_CODE (NODE) == CONST_DECL \
|| TREE_CODE (NODE) == TYPE_DECL \
|| TREE_CODE (NODE) == TEMPLATE_DECL \
- || TREE_CODE (NODE) == USING_DECL)
+ || TREE_CODE (NODE) == USING_DECL \
+ || TREE_CODE (NODE) == CONCEPT_DECL)
/* DECL_LANG_SPECIFIC for the above codes. */
unsigned hidden_friend_p : 1;
unsigned omp_declare_reduction_p : 1;
unsigned has_dependent_explicit_spec_p : 1;
- unsigned spare : 12;
+ unsigned immediate_fn_p : 1;
+ unsigned maybe_deleted : 1;
+ unsigned spare : 10;
/* 32-bits padding on 64-bit host. */
union lang_decl_u3
{
struct cp_token_cache * GTY ((tag ("1"))) pending_inline_info;
- struct language_function * GTY ((tag ("0")))
- saved_language_function;
+ tree GTY ((tag ("0"))) saved_auto_return_type;
} GTY ((desc ("%1.pending_inline_p"))) u;
};
struct lang_decl_base base;
cp_binding_level *level;
- /* using directives and inline children. These need to be va_gc,
- because of PCH. */
- vec<tree, va_gc> *usings;
+ /* Inline children. These need to be va_gc, because of PCH. */
vec<tree, va_gc> *inlinees;
/* Hash table of bound decls. It'd be nice to have this inline, but
(DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (NODE) \
|| DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (NODE))
-/* Nonzero if NODE (a FUNCTION_DECL) is a cloned constructor or
+/* Nonzero if NODE (a _DECL) is a cloned constructor or
destructor. */
-#define DECL_CLONED_FUNCTION_P(NODE) (!!decl_cloned_function_p (NODE, true))
+#define DECL_CLONED_FUNCTION_P(NODE) \
+ (DECL_NAME (NODE) \
+ && IDENTIFIER_CDTOR_P (DECL_NAME (NODE)) \
+ && !DECL_MAYBE_IN_CHARGE_CDTOR_P (NODE))
/* If DECL_CLONED_FUNCTION_P holds, this is the function that was
cloned. */
-#define DECL_CLONED_FUNCTION(NODE) (*decl_cloned_function_p (NODE, false))
+#define DECL_CLONED_FUNCTION(NODE) \
+ (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE))->u.fn.u5.cloned_function)
/* Perform an action for each clone of FN, if FN is a function with
clones. This macro should be used like:
/* Nonzero for _DECL means that this decl appears in (or will appear
in) as a member in a RECORD_TYPE or UNION_TYPE node. It is also for
detecting circularity in case members are multiply defined. In the
- case of a VAR_DECL, it is also used to determine how program storage
- should be allocated. */
+ case of a VAR_DECL, it means that no definition has been seen, even
+ if an initializer has been. */
#define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3 (NODE))
/* Nonzero for a VAR_DECL means that the variable's initialization (if
/* Nonzero for a VAR_DECL iff an explicit initializer was provided
or a non-trivial constructor is called. */
#define DECL_NONTRIVIALLY_INITIALIZED_P(NODE) \
- (TREE_LANG_FLAG_3 (VAR_DECL_CHECK (NODE)))
+ (TREE_LANG_FLAG_6 (VAR_DECL_CHECK (NODE)))
/* Nonzero for a VAR_DECL that was initialized with a
constant-expression. */
(DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \
|| TREE_CODE (NODE) == FIELD_DECL)
-/* Nonzero for _DECL means that this member object type
+/* Nonzero for a FIELD_DECL means that this member object type
is mutable. */
-#define DECL_MUTABLE_P(NODE) (DECL_LANG_FLAG_0 (NODE))
+#define DECL_MUTABLE_P(NODE) (DECL_LANG_FLAG_0 (FIELD_DECL_CHECK (NODE)))
/* Nonzero for _DECL means that this constructor or conversion function is
non-converting. */
#define DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P(NODE) \
(LANG_DECL_FN_CHECK (NODE)->has_dependent_explicit_spec_p)
+/* Nonzero for a defaulted FUNCTION_DECL for which we haven't decided yet if
+ it's deleted. */
+#define DECL_MAYBE_DELETED(NODE) \
+ (LANG_DECL_FN_CHECK (NODE)->maybe_deleted)
+
/* True (in a FUNCTION_DECL) if NODE is a virtual function that is an
invalid overrider for a function from a base class. Once we have
complained about an invalid overrider we avoid complaining about it
#define DECL_EXTERN_C_FUNCTION_P(NODE) \
(DECL_NON_THUNK_FUNCTION_P (NODE) && DECL_EXTERN_C_P (NODE))
-/* True iff DECL is an entity with vague linkage whose definition is
- available in this translation unit. */
-#define DECL_REPO_AVAILABLE_P(NODE) \
- (DECL_LANG_SPECIFIC (NODE)->u.base.repo_available_p)
-
/* True if DECL is declared 'constexpr'. */
#define DECL_DECLARED_CONSTEXPR_P(DECL) \
DECL_LANG_FLAG_8 (VAR_OR_FUNCTION_DECL_CHECK (STRIP_TEMPLATE (DECL)))
+/* True if FNDECL is an immediate function. */
+#define DECL_IMMEDIATE_FUNCTION_P(NODE) \
+ (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (STRIP_TEMPLATE (NODE))) \
+ ? LANG_DECL_FN_CHECK (NODE)->immediate_fn_p \
+ : false)
+#define SET_DECL_IMMEDIATE_FUNCTION_P(NODE) \
+ (retrofit_lang_decl (FUNCTION_DECL_CHECK (NODE)), \
+ LANG_DECL_FN_CHECK (NODE)->immediate_fn_p = true)
+
// True if NODE was declared as 'concept'. The flag implies that the
// declaration is constexpr, that the declaration cannot be specialized or
// refined, and that the result type must be convertible to bool.
both the primary typeinfo object and the associated NTBS name. */
#define DECL_TINFO_P(NODE) TREE_LANG_FLAG_4 (VAR_DECL_CHECK (NODE))
-/* 1 iff VAR_DECL node NODE is virtual table or VTT. */
-#define DECL_VTABLE_OR_VTT_P(NODE) TREE_LANG_FLAG_5 (VAR_DECL_CHECK (NODE))
+/* 1 iff VAR_DECL node NODE is virtual table or VTT. We forward to
+ DECL_VIRTUAL_P from the common code, as that has the semantics we
+ need. But we want a more descriptive name. */
+#define DECL_VTABLE_OR_VTT_P(NODE) DECL_VIRTUAL_P (VAR_DECL_CHECK (NODE))
/* 1 iff FUNCTION_TYPE or METHOD_TYPE has a ref-qualifier (either & or &&). */
#define FUNCTION_REF_QUALIFIED(NODE) \
#define FUNCTION_RVALUE_QUALIFIED(NODE) \
TREE_LANG_FLAG_5 (FUNC_OR_METHOD_CHECK (NODE))
-/* Returns 1 iff VAR_DECL is a construction virtual table.
- DECL_VTABLE_OR_VTT_P will be true in this case and must be checked
- before using this macro. */
-#define DECL_CONSTRUCTION_VTABLE_P(NODE) \
- TREE_LANG_FLAG_6 (VAR_DECL_CHECK (NODE))
-
/* 1 iff NODE is function-local, but for types. */
#define LOCAL_CLASS_P(NODE) \
(decl_function_context (TYPE_MAIN_DECL (NODE)) != NULL_TREE)
#define DECL_NAMESPACE_INLINE_P(NODE) \
TREE_LANG_FLAG_0 (NAMESPACE_DECL_CHECK (NODE))
-/* In a NAMESPACE_DECL, a vector of using directives. */
-#define DECL_NAMESPACE_USING(NODE) \
- (LANG_DECL_NS_CHECK (NODE)->usings)
-
/* In a NAMESPACE_DECL, a vector of inline namespaces. */
#define DECL_NAMESPACE_INLINEES(NODE) \
(LANG_DECL_NS_CHECK (NODE)->inlinees)
/* Nonzero if NODE is the std namespace. */
#define DECL_NAMESPACE_STD_P(NODE) \
- (TREE_CODE (NODE) == NAMESPACE_DECL \
- && CP_DECL_CONTEXT (NODE) == global_namespace \
- && DECL_NAME (NODE) == std_identifier)
+ ((NODE) == std_node)
/* In a TREE_LIST in an attribute list, indicates that the attribute
must be applied at instantiation time. */
#define DECL_DEPENDENT_P(NODE) DECL_LANG_FLAG_0 (USING_DECL_CHECK (NODE))
/* The scope named in a using decl. */
-#define USING_DECL_SCOPE(NODE) TREE_TYPE (USING_DECL_CHECK (NODE))
+#define USING_DECL_SCOPE(NODE) DECL_RESULT_FLD (USING_DECL_CHECK (NODE))
/* The decls named by a using decl. */
#define USING_DECL_DECLS(NODE) DECL_INITIAL (USING_DECL_CHECK (NODE))
&& TREE_CODE (TYPE_NAME (NODE)) == TYPE_DECL \
&& TYPE_DECL_ALIAS_P (TYPE_NAME (NODE)))
-/* If non-NULL for a VAR_DECL, FUNCTION_DECL, TYPE_DECL or
- TEMPLATE_DECL, the entity is either a template specialization (if
+/* If non-NULL for a VAR_DECL, FUNCTION_DECL, TYPE_DECL, TEMPLATE_DECL,
+ or CONCEPT_DECL, the entity is either a template specialization (if
DECL_USE_TEMPLATE is nonzero) or the abstract instance of the
template itself.
global function f. In this case, DECL_TEMPLATE_INFO for S<int>::f
will be non-NULL, but DECL_USE_TEMPLATE will be zero. */
#define DECL_TEMPLATE_INFO(NODE) \
- (DECL_LANG_SPECIFIC (VAR_TEMPL_TYPE_FIELD_OR_FUNCTION_DECL_CHECK (NODE)) \
+ (DECL_LANG_SPECIFIC (TEMPLATE_INFO_DECL_CHECK (NODE)) \
->u.min.template_info)
/* For a lambda capture proxy, its captured variable. */
? (TYPE_LANG_SLOT_1 (NODE) = (VAL)) \
: (DECL_TEMPLATE_INFO (TYPE_NAME (NODE)) = (VAL)))
-#define TI_TEMPLATE(NODE) TREE_TYPE (TEMPLATE_INFO_CHECK (NODE))
-#define TI_ARGS(NODE) TREE_CHAIN (TEMPLATE_INFO_CHECK (NODE))
+#define TI_TEMPLATE(NODE) \
+ ((struct tree_template_info*)TEMPLATE_INFO_CHECK (NODE))->tmpl
+#define TI_ARGS(NODE) \
+ ((struct tree_template_info*)TEMPLATE_INFO_CHECK (NODE))->args
#define TI_PENDING_TEMPLATE_FLAG(NODE) \
TREE_LANG_FLAG_1 (TEMPLATE_INFO_CHECK (NODE))
/* For a given TREE_VEC containing a template argument list,
template <typename T> struct S {};
template <typename T> struct S<T*> {};
- the CLASSTPYE_TI_TEMPLATE for S<int*> will be S, not the S<T*>. */
+ the CLASSTPYE_TI_TEMPLATE for S<int*> will be S, not the S<T*>.
+
+ For a member class template, CLASSTYPE_TI_TEMPLATE always refers to the
+ partial instantiation rather than the primary template. CLASSTYPE_TI_ARGS
+ are for the primary template if the partial instantiation isn't
+ specialized, or for the explicit specialization if it is, e.g.
+
+ template <class T> class C { template <class U> class D; }
+ template <> template <class U> class C<int>::D; */
#define CLASSTYPE_TI_TEMPLATE(NODE) TI_TEMPLATE (CLASSTYPE_TEMPLATE_INFO (NODE))
#define CLASSTYPE_TI_ARGS(NODE) TI_ARGS (CLASSTYPE_TEMPLATE_INFO (NODE))
select. */
#define ARGUMENT_PACK_SELECT_INDEX(NODE) \
(((struct tree_argument_pack_select *)ARGUMENT_PACK_SELECT_CHECK (NODE))->index)
-
+
#define FOLD_EXPR_CHECK(NODE) \
TREE_CHECK4 (NODE, UNARY_LEFT_FOLD_EXPR, UNARY_RIGHT_FOLD_EXPR, \
BINARY_LEFT_FOLD_EXPR, BINARY_RIGHT_FOLD_EXPR)
#define FOLD_EXPR_INIT(NODE) \
TREE_OPERAND (BINARY_FOLD_EXPR_CHECK (NODE), 2)
-/* In a FUNCTION_DECL, the saved language-specific per-function data. */
-#define DECL_SAVED_FUNCTION_DATA(NODE) \
+/* In a FUNCTION_DECL, the saved auto-return pattern. */
+#define DECL_SAVED_AUTO_RETURN_TYPE(NODE) \
(LANG_DECL_FN_CHECK (FUNCTION_DECL_CHECK (NODE)) \
- ->u.saved_language_function)
+ ->u.saved_auto_return_type)
/* True if NODE is an implicit INDIRECT_REF from convert_from_reference. */
#define REFERENCE_REF_P(NODE) \
&& TREE_TYPE (TREE_OPERAND (NODE, 0)) \
&& TYPE_REF_P (TREE_TYPE (TREE_OPERAND ((NODE), 0))))
-/* True if NODE is a REFERENCE_TYPE which is OK to instantiate to be a
- reference to VLA type, because it's used for VLA capture. */
-#define REFERENCE_VLA_OK(NODE) \
- (TYPE_LANG_FLAG_5 (REFERENCE_TYPE_CHECK (NODE)))
-
#define NEW_EXPR_USE_GLOBAL(NODE) \
TREE_LANG_FLAG_0 (NEW_EXPR_CHECK (NODE))
#define DELETE_EXPR_USE_GLOBAL(NODE) \
should be performed at instantiation time. */
#define KOENIG_LOOKUP_P(NODE) TREE_LANG_FLAG_0 (CALL_EXPR_CHECK (NODE))
+/* In a CALL_EXPR, true for allocator calls from new or delete
+ expressions. */
+#define CALL_FROM_NEW_OR_DELETE_P(NODE) \
+ TREE_LANG_FLAG_2 (CALL_EXPR_CHECK (NODE))
+
/* True if the arguments to NODE should be evaluated in left-to-right
order regardless of PUSH_ARGS_REVERSED. */
#define CALL_EXPR_ORDERED_ARGS(NODE) \
/* True if NODE was declared with auto in its return type, but it has
started compilation and so the return type might have been changed by
return type deduction; its declared return type should be found in
- DECL_STRUCT_FUNCTION(NODE)->language->x_auto_return_pattern. */
+ DECL_SAVED_AUTO_RETURN_TYPE (NODE). */
#define FNDECL_USED_AUTO(NODE) \
TREE_LANG_FLAG_2 (FUNCTION_DECL_CHECK (NODE))
/* [basic.fundamental]
Integral and floating types are collectively called arithmetic
- types.
+ types.
As a GNU extension, we also accept complex types.
Arithmetic types, enumeration types, pointer types,
pointer-to-member types, and std::nullptr_t are collectively called
scalar types.
-
+
Keep these checks in ascending code order. */
#define SCALAR_TYPE_P(TYPE) \
(TYPE_PTRDATAMEM_P (TYPE) \
Scoped enumeration types are different from normal (unscoped)
enumeration types in several ways:
-
+
- The enumerators of a scoped enumeration type are only available
within the scope of the enumeration type and not in the
enclosing scope. For example, the Red color can be referred to
As an extension, we also treat vectors as aggregates. Keep these
checks in ascending code order. */
#define CP_AGGREGATE_TYPE_P(TYPE) \
- (TREE_CODE (TYPE) == VECTOR_TYPE \
- ||TREE_CODE (TYPE) == ARRAY_TYPE \
- || (CLASS_TYPE_P (TYPE) && !CLASSTYPE_NON_AGGREGATE (TYPE)))
+ (gnu_vector_type_p (TYPE) \
+ || TREE_CODE (TYPE) == ARRAY_TYPE \
+ || (CLASS_TYPE_P (TYPE) && COMPLETE_TYPE_P (TYPE) && !CLASSTYPE_NON_AGGREGATE (TYPE)))
/* Nonzero for a class type means that the class type has a
user-declared constructor. */
B b{1,2}, not B b({1,2}) or B b = {1,2}. */
#define CONSTRUCTOR_IS_DIRECT_INIT(NODE) (TREE_LANG_FLAG_0 (CONSTRUCTOR_CHECK (NODE)))
+/* True if this CONSTRUCTOR is instantiation-dependent and needs to be
+ substituted. */
+#define CONSTRUCTOR_IS_DEPENDENT(NODE) \
+ (TREE_LANG_FLAG_1 (CONSTRUCTOR_CHECK (NODE)))
+
/* True if this CONSTRUCTOR should not be used as a variable initializer
because it was loaded from a constexpr variable with mutable fields. */
#define CONSTRUCTOR_MUTABLE_POISON(NODE) \
#define DIRECT_LIST_INIT_P(NODE) \
(BRACE_ENCLOSED_INITIALIZER_P (NODE) && CONSTRUCTOR_IS_DIRECT_INIT (NODE))
+/* True if this is a designated initializer (when we allow initializer-clauses
+ mixed with designated-initializer-clauses set whenever there is at least
+ one designated-initializer-clause), or a C99 designator. */
+#define CONSTRUCTOR_IS_DESIGNATED_INIT(NODE) \
+ (TREE_LANG_FLAG_6 (CONSTRUCTOR_CHECK (NODE)))
+
+/* True if this CONSTRUCTOR comes from a parenthesized list of values, e.g.
+ A(1, 2, 3). */
+#define CONSTRUCTOR_IS_PAREN_INIT(NODE) \
+ (CONSTRUCTOR_CHECK(NODE)->base.private_flag)
+
/* True if NODE represents a conversion for direct-initialization in a
template. Set by perform_implicit_conversion_flags. */
#define IMPLICIT_CONV_EXPR_DIRECT_INIT(NODE) \
#define IMPLICIT_CONV_EXPR_NONTYPE_ARG(NODE) \
(TREE_LANG_FLAG_1 (IMPLICIT_CONV_EXPR_CHECK (NODE)))
-/* Nonzero means that an object of this type can not be initialized using
+/* True if NODE represents a conversion for braced-init-list in a
+ template. Set by perform_implicit_conversion_flags. */
+#define IMPLICIT_CONV_EXPR_BRACED_INIT(NODE) \
+ (TREE_LANG_FLAG_2 (IMPLICIT_CONV_EXPR_CHECK (NODE)))
+
+/* Nonzero means that an object of this type cannot be initialized using
an initializer list. */
#define CLASSTYPE_NON_AGGREGATE(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->non_aggregate)
/* Nonzero for _TYPE node means that this type does not have a trivial
destructor. Therefore, destroying an object of this type will
involve a call to a destructor. This can apply to objects of
- ARRAY_TYPE is the type of the elements needs a destructor. */
+ ARRAY_TYPE if the type of the elements needs a destructor. */
#define TYPE_HAS_NONTRIVIAL_DESTRUCTOR(NODE) \
(TYPE_LANG_FLAG_4 (NODE))
#define TYPE_OBJ_P(NODE) \
(!TYPE_REF_P (NODE) \
&& !VOID_TYPE_P (NODE) \
- && TREE_CODE (NODE) != FUNCTION_TYPE \
- && TREE_CODE (NODE) != METHOD_TYPE)
+ && !FUNC_OR_METHOD_TYPE_P (NODE))
/* Returns true if NODE is a pointer to an object. Keep these checks
in ascending tree code order. */
void. Keep these checks in ascending tree code order. */
#define TYPE_PTROBV_P(NODE) \
(TYPE_PTR_P (NODE) \
- && !(TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE \
- || TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE))
+ && !FUNC_OR_METHOD_TYPE_P (TREE_TYPE (NODE)))
/* Returns true if NODE is a pointer to function type. */
#define TYPE_PTRFN_P(NODE) \
(DECLTYPE_TYPE_CHECK (NODE))->type_common.string_flag
/* These flags indicate that we want different semantics from normal
- decltype: lambda capture just drops references, init capture
- uses auto semantics, lambda proxies look through implicit dereference. */
+ decltype: lambda capture just drops references,
+ lambda proxies look through implicit dereference. */
#define DECLTYPE_FOR_LAMBDA_CAPTURE(NODE) \
TREE_LANG_FLAG_0 (DECLTYPE_TYPE_CHECK (NODE))
-#define DECLTYPE_FOR_INIT_CAPTURE(NODE) \
- TREE_LANG_FLAG_1 (DECLTYPE_TYPE_CHECK (NODE))
#define DECLTYPE_FOR_LAMBDA_PROXY(NODE) \
TREE_LANG_FLAG_2 (DECLTYPE_TYPE_CHECK (NODE))
#define DECLTYPE_FOR_REF_CAPTURE(NODE) \
/* Define fields and accessors for nodes representing declared names. */
-/* Nonzero if TYPE is an unnamed class with a typedef for linkage purposes. */
-#define TYPE_WAS_UNNAMED(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->was_anonymous)
+/* True if TYPE is an unnamed structured type with a typedef for
+ linkage purposes. In that case TYPE_NAME and TYPE_STUB_DECL of the
+ MAIN-VARIANT are different. */
+#define TYPE_WAS_UNNAMED(NODE) \
+ (TYPE_NAME (TYPE_MAIN_VARIANT (NODE)) \
+ != TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE)))
/* C++: all of these are overloaded! These apply only to TYPE_DECLs. */
parameter). The TREE_PURPOSE is the default value, if any. The
TEMPLATE_PARM_INDEX for the parameter is available as the
DECL_INITIAL (for a PARM_DECL) or as the TREE_TYPE (for a
- TYPE_DECL).
+ TYPE_DECL).
FIXME: CONST_CAST_TREE is a hack that hopefully will go away after
tree is converted to C++ class hiearchy. */
template <> int min<int> (int, int),
3=explicit instantiation, e.g.:
-
+
template int min<int> (int, int);
Note that NODE will be marked as a specialization even if the
template it is instantiating is not a primary template. For
example, given:
- template <typename T> struct O {
+ template <typename T> struct O {
void f();
- struct I {};
+ struct I {};
};
-
+
both O<int>::f and O<int>::I will be marked as instantiations.
If DECL_USE_TEMPLATE is nonzero, then DECL_TEMPLATE_INFO will also
/* Used while gimplifying continue statements bound to OMP_FOR nodes. */
#define OMP_FOR_GIMPLIFYING_P(NODE) \
- (TREE_LANG_FLAG_0 (OMP_LOOP_CHECK (NODE)))
+ (TREE_LANG_FLAG_0 (OMP_LOOPING_CHECK (NODE)))
/* A language-specific token attached to the OpenMP data clauses to
hold code (or code fragments) related to ctors, dtors, and op=.
See semantics.c for details. */
#define CP_OMP_CLAUSE_INFO(NODE) \
TREE_TYPE (OMP_CLAUSE_RANGE_CHECK (NODE, OMP_CLAUSE_PRIVATE, \
- OMP_CLAUSE_LINEAR))
+ OMP_CLAUSE__CONDTEMP_))
/* Nonzero if this transaction expression's body contains statements. */
#define TRANSACTION_EXPR_IS_STMT(NODE) \
destroyed. */
sfk_conversion, /* A conversion operator. */
sfk_deduction_guide, /* A class template deduction guide. */
+ sfk_comparison, /* A comparison operator (e.g. ==, <, <=>). */
sfk_virtual_destructor /* Used by member synthesis fns. */
};
declaration. */
tf_no_cleanup = 1 << 10, /* Do not build a cleanup
(build_target_expr and friends) */
+ tf_norm = 1 << 11, /* Build diagnostic information during
+ constraint normalization. */
/* Convenient substitution flags combinations. */
tf_warning_or_error = tf_warning | tf_error
};
/* RAII class used to inhibit the evaluation of operands during parsing
and template instantiation. Evaluation warnings are also inhibited. */
-struct cp_unevaluated
+class cp_unevaluated
{
+public:
cp_unevaluated ();
~cp_unevaluated ();
};
/* The reverse: an RAII class used for nested contexts that are evaluated even
if the enclosing context is not. */
-struct cp_evaluated
+class cp_evaluated
{
+public:
int uneval;
int inhibit;
cp_evaluated ()
// specializations. When the stack goes out of scope, the
// previous pointer map is restored.
enum lss_policy { lss_blank, lss_copy };
-struct local_specialization_stack
+class local_specialization_stack
{
+public:
local_specialization_stack (lss_policy = lss_blank);
~local_specialization_stack ();
#endif /* NO_DOLLAR_IN_LABEL */
#endif /* NO_DOT_IN_LABEL */
-#define LAMBDANAME_PREFIX "__lambda"
-#define LAMBDANAME_FORMAT LAMBDANAME_PREFIX "%d"
-
#define UDLIT_OP_ANSI_PREFIX "operator\"\""
#define UDLIT_OP_ANSI_FORMAT UDLIT_OP_ANSI_PREFIX "%s"
#define UDLIT_OP_MANGLED_PREFIX "li"
#define LOOKUP_NO_NON_INTEGRAL (LOOKUP_NO_RVAL_BIND << 1)
/* Used for delegating constructors in order to diagnose self-delegation. */
#define LOOKUP_DELEGATING_CONS (LOOKUP_NO_NON_INTEGRAL << 1)
+/* Allow initialization of a flexible array members. */
+#define LOOKUP_ALLOW_FLEXARRAY_INIT (LOOKUP_DELEGATING_CONS << 1)
+/* Require constant initialization of a non-constant variable. */
+#define LOOKUP_CONSTINIT (LOOKUP_ALLOW_FLEXARRAY_INIT << 1)
+/* We're looking for either a rewritten comparison operator candidate or the
+ operator to use on the former's result. We distinguish between the two by
+ knowing that comparisons other than == and <=> must be the latter, as must
+ a <=> expression trying to rewrite to <=> without reversing. */
+#define LOOKUP_REWRITTEN (LOOKUP_CONSTINIT << 1)
+/* Reverse the order of the two arguments for comparison rewriting. First we
+ swap the arguments in add_operator_candidates, then we swap the conversions
+ in add_candidate (so that they correspond to the original order of the
+ args), then we swap the conversions back in build_new_op_1 (so they
+ correspond to the order of the args in the candidate). */
+#define LOOKUP_REVERSED (LOOKUP_REWRITTEN << 1)
+/* We're initializing an aggregate from a parenthesized list of values. */
+#define LOOKUP_AGGREGATE_PAREN_INIT (LOOKUP_REVERSED << 1)
#define LOOKUP_NAMESPACES_ONLY(F) \
(((F) & LOOKUP_PREFER_NAMESPACES) && !((F) & LOOKUP_PREFER_TYPES))
#define CONV_CONST 4
#define CONV_REINTERPRET 8
#define CONV_PRIVATE 16
-/* #define CONV_NONCONVERTING 32 */
-#define CONV_FORCE_TEMP 64
-#define CONV_FOLD 128
+#define CONV_FORCE_TEMP 32
+#define CONV_FOLD 64
#define CONV_OLD_CONVERT (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
| CONV_REINTERPRET)
#define CONV_C_CAST (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
#define TFF_NO_TEMPLATE_BINDINGS (1 << 13)
#define TFF_POINTER (1 << 14)
+/* These constants can be used as bit flags to control strip_typedefs.
+
+ STF_USER_VISIBLE: use heuristics to try to avoid stripping user-facing
+ aliases of internal details. This is intended for diagnostics,
+ where it should (for example) give more useful "aka" types.
+
+ STF_STRIP_DEPENDENT: allow the stripping of aliases with dependent
+ template parameters, relying on code elsewhere to report any
+ appropriate diagnostics. */
+const unsigned int STF_USER_VISIBLE = 1U;
+const unsigned int STF_STRIP_DEPENDENT = 1U << 1;
+
/* Returns the TEMPLATE_DECL associated to a TEMPLATE_TEMPLATE_PARM
node. */
#define TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL(NODE) \
#define IDENTIFIER_OVL_OP_FLAGS(NODE) \
(IDENTIFIER_OVL_OP_INFO (NODE)->flags)
+inline tree ovl_op_identifier (bool isass, tree_code code)
+{ return OVL_OP_INFO(isass, code)->identifier; }
+inline tree ovl_op_identifier (tree_code code) { return ovl_op_identifier (false, code); }
+#define assign_op_identifier (ovl_op_info[true][OVL_OP_NOP_EXPR].identifier)
+#define call_op_identifier (ovl_op_info[false][OVL_OP_CALL_EXPR].identifier)
+
/* A type-qualifier, or bitmask therefore, using the TYPE_QUAL
constants. */
ds_alias,
ds_constexpr,
ds_complex,
+ ds_constinit,
+ ds_consteval,
ds_thread,
ds_type_spec,
ds_redefined_builtin_type_spec,
BOOL_BITFIELD gnu_thread_keyword_p : 1;
/* True iff the type is a decltype. */
BOOL_BITFIELD decltype_p : 1;
+ /* True iff the alternate "__intN__" form of the __intN type has been
+ used. */
+ BOOL_BITFIELD int_n_alt: 1;
};
/* The various kinds of declarators. */
enum cp_built_in_function {
CP_BUILT_IN_IS_CONSTANT_EVALUATED,
CP_BUILT_IN_INTEGER_PACK,
+ CP_BUILT_IN_SOURCE_LOCATION,
CP_BUILT_IN_LAST
};
return TREE_TYPE (type_of_this_parm (fntype));
}
-/* True iff T is a variable template declaration. */
-inline bool
-variable_template_p (tree t)
-{
- if (TREE_CODE (t) != TEMPLATE_DECL)
- return false;
- if (!PRIMARY_TEMPLATE_P (t))
- return false;
- if (tree r = DECL_TEMPLATE_RESULT (t))
- return VAR_P (r);
- return false;
-}
-
-/* True iff T is a variable concept definition. That is, T is
- a variable template declared with the concept specifier. */
-inline bool
-variable_concept_p (tree t)
-{
- if (TREE_CODE (t) != TEMPLATE_DECL)
- return false;
- if (tree r = DECL_TEMPLATE_RESULT (t))
- return VAR_P (r) && DECL_DECLARED_CONCEPT_P (r);
- return false;
-}
-
-/* True iff T is a concept definition. That is, T is a variable or function
- template declared with the concept specifier. */
-inline bool
-concept_template_p (tree t)
-{
- if (TREE_CODE (t) != TEMPLATE_DECL)
- return false;
- if (tree r = DECL_TEMPLATE_RESULT (t))
- return VAR_OR_FUNCTION_DECL_P (r) && DECL_DECLARED_CONCEPT_P (r);
- return false;
-}
-
/* A parameter list indicating for a function with no parameters,
e.g "int f(void)". */
extern cp_parameter_declarator *no_parameters;
extern bool is_properly_derived_from (tree, tree);
extern tree initialize_reference (tree, tree, int,
tsubst_flags_t);
-extern tree extend_ref_init_temps (tree, tree, vec<tree, va_gc>**);
+extern tree extend_ref_init_temps (tree, tree,
+ vec<tree, va_gc>**,
+ tree * = NULL);
extern tree make_temporary_var_for_ref_to_temp (tree, tree);
extern bool type_has_extended_temps (tree);
extern tree strip_top_quals (tree);
extern tree perform_implicit_conversion (tree, tree, tsubst_flags_t);
extern tree perform_implicit_conversion_flags (tree, tree, tsubst_flags_t, int);
extern tree build_converted_constant_expr (tree, tree, tsubst_flags_t);
+extern tree build_converted_constant_bool_expr (tree, tsubst_flags_t);
extern tree perform_direct_initialization_if_possible (tree, tree, bool,
tsubst_flags_t);
+extern vec<tree,va_gc> *resolve_args (vec<tree,va_gc>*, tsubst_flags_t);
extern tree in_charge_arg_for_name (tree);
extern tree build_cxx_call (tree, int, tree *,
- tsubst_flags_t);
+ tsubst_flags_t,
+ tree = NULL_TREE);
extern bool is_std_init_list (tree);
extern bool is_list_ctor (tree);
extern void validate_conversion_obstack (void);
extern void mark_versions_used (tree);
extern bool cp_warn_deprecated_use (tree, tsubst_flags_t = tf_warning_or_error);
+extern void cp_warn_deprecated_use_scopes (tree);
extern tree get_function_version_dispatcher (tree);
/* in class.c */
extern int resolves_to_fixed_type_p (tree, int *);
extern void init_class_processing (void);
extern int is_empty_class (tree);
-extern bool is_really_empty_class (tree);
+extern bool is_really_empty_class (tree, bool);
extern void pushclass (tree);
extern void popclass (void);
extern void push_nested_class (tree);
extern void check_for_override (tree, tree);
extern void push_class_stack (void);
extern void pop_class_stack (void);
-extern bool default_ctor_p (tree);
+extern bool default_ctor_p (const_tree);
extern bool type_has_user_nondefault_constructor (tree);
extern tree in_class_defaulted_default_constructor (tree);
extern bool user_provided_p (tree);
extern tree default_init_uninitialized_part (tree);
extern bool trivial_default_constructor_is_constexpr (tree);
extern bool type_has_constexpr_default_constructor (tree);
+extern bool type_has_constexpr_destructor (tree);
extern bool type_has_virtual_destructor (tree);
extern bool classtype_has_move_assign_or_move_ctor_p (tree, bool user_declared);
extern bool classtype_has_non_deleted_move_ctor (tree);
extern tree classtype_has_depr_implicit_copy (tree);
+extern bool classtype_has_op (tree, tree_code);
+extern tree classtype_has_defaulted_op (tree, tree_code);
extern bool type_build_ctor_call (tree);
extern bool type_build_dtor_call (tree);
extern void explain_non_literal_class (tree);
extern tree missing_abi_tags (tree);
extern void fixup_type_variants (tree);
extern void fixup_attribute_variants (tree);
-extern tree* decl_cloned_function_p (const_tree, bool);
extern void clone_function_decl (tree, bool);
extern void adjust_clone_args (tree);
extern void deduce_noexcept_on_destructor (tree);
/* in name-lookup.c */
extern void maybe_push_cleanup_level (tree);
-extern tree make_anon_name (void);
extern tree maybe_push_decl (tree);
extern tree current_decl_namespace (void);
extern bool note_iteration_stmt_body_start (void);
extern void note_iteration_stmt_body_end (bool);
extern void determine_local_discriminator (tree);
-extern tree make_lambda_name (void);
extern int decls_match (tree, tree, bool = true);
extern bool maybe_version_functions (tree, tree, bool);
extern tree duplicate_decls (tree, tree, bool);
extern tree start_decl (const cp_declarator *, cp_decl_specifier_seq *, int, tree, tree, tree *);
extern void start_decl_1 (tree, bool);
extern bool check_array_initializer (tree, tree, tree);
+extern void omp_declare_variant_finalize (tree, tree);
extern void cp_finish_decl (tree, tree, bool, tree, int);
extern tree lookup_decomp_type (tree);
extern void cp_maybe_mangle_decomp (tree, tree, unsigned int);
extern tree cp_fname_init (const char *, tree *);
extern tree cxx_builtin_function (tree decl);
extern tree cxx_builtin_function_ext_scope (tree decl);
+extern tree cxx_simulate_builtin_function_decl (tree);
extern tree check_elaborated_type_specifier (enum tag_types, tree, bool);
extern void warn_extern_redeclared_static (tree, tree);
extern tree cxx_comdat_group (tree);
extern bool cp_missing_noreturn_ok_p (tree);
extern bool is_direct_enum_init (tree, tree);
extern void initialize_artificial_var (tree, vec<constructor_elt, va_gc> *);
-extern tree check_var_type (tree, tree);
+extern tree check_var_type (tree, tree, location_t);
extern tree reshape_init (tree, tree, tsubst_flags_t);
extern tree next_initializable_field (tree);
extern tree fndecl_declared_return_type (tree);
unsigned HOST_WIDE_INT);
extern bool check_for_uninitialized_const_var (tree, bool, tsubst_flags_t);
extern tree build_explicit_specifier (tree, tsubst_flags_t);
+extern void do_push_parm_decls (tree, tree, tree *);
/* in decl2.c */
extern void record_mangling (tree, bool);
extern void grokclassfn (tree, tree,
enum overload_flags);
extern tree grok_array_decl (location_t, tree, tree, bool);
-extern tree delete_sanity (tree, tree, bool, int, tsubst_flags_t);
+extern tree delete_sanity (location_t, tree, tree, bool,
+ int, tsubst_flags_t);
extern tree check_classfn (tree, tree, tree);
extern void check_member_template (tree);
extern tree grokfield (const cp_declarator *, cp_decl_specifier_seq *,
extern tree get_guard (tree);
extern tree get_guard_cond (tree, bool);
extern tree set_guard (tree);
-extern tree get_tls_wrapper_fn (tree);
+extern tree maybe_get_tls_wrapper_call (tree);
extern void mark_needed (tree);
extern bool decl_needed_p (tree);
extern void note_vague_linkage_fn (tree);
extern tree vtv_start_verification_constructor_init_function (void);
extern tree vtv_finish_verification_constructor_init_function (tree);
extern bool cp_omp_mappable_type (tree);
+extern bool cp_omp_emit_unmappable_type_notes (tree);
extern void cp_check_const_attributes (tree);
/* in error.c */
extern tree expand_start_catch_block (tree);
extern void expand_end_catch_block (void);
extern tree build_exc_ptr (void);
-extern tree build_throw (tree);
+extern tree build_throw (location_t, tree);
extern int nothrow_libfn_p (const_tree);
extern void check_handlers (tree);
extern tree finish_noexcept_expr (tree, tsubst_flags_t);
extern void finish_eh_spec_block (tree, tree);
extern tree build_eh_type_type (tree);
extern tree cp_protect_cleanup_actions (void);
-extern tree create_try_catch_expr (tree, tree);
+extern tree template_parms_to_args (tree);
+extern tree template_parms_level_to_args (tree);
+extern tree generic_targs_for (tree);
/* in expr.c */
extern tree cplus_expand_constant (tree);
extern tree throw_bad_array_new_length (void);
extern bool type_has_new_extended_alignment (tree);
extern unsigned malloc_alignment (void);
+extern tree build_new_constexpr_heap_type (tree, tree, tree);
extern tree build_new (vec<tree, va_gc> **, tree, tree,
vec<tree, va_gc> **, int,
tsubst_flags_t);
extern tree get_temp_regvar (tree, tree);
extern tree build_vec_init (tree, tree, tree, bool, int,
tsubst_flags_t);
-extern tree build_delete (tree, tree,
+extern tree build_delete (location_t, tree, tree,
special_function_kind,
int, int, tsubst_flags_t);
extern void push_base_cleanups (void);
-extern tree build_vec_delete (tree, tree,
+extern tree build_vec_delete (location_t, tree, tree,
special_function_kind, int,
tsubst_flags_t);
extern tree create_temporary_var (tree);
extern bool parsing_nsdmi (void);
extern bool parsing_default_capturing_generic_lambda_in_template (void);
extern void inject_this_parameter (tree, cp_cv_quals);
-extern location_t defarg_location (tree);
+extern location_t defparse_location (tree);
extern void maybe_show_extern_c_location (void);
extern bool literal_integer_zerop (const_tree);
/* in pt.c */
+extern void push_access_scope (tree);
+extern void pop_access_scope (tree);
extern bool check_template_shadow (tree);
extern bool check_auto_in_tmpl_args (tree, tree);
extern tree get_innermost_template_args (tree, int);
extern void check_template_variable (tree);
extern tree make_auto (void);
extern tree make_decltype_auto (void);
+extern tree make_constrained_auto (tree, tree);
+extern tree make_constrained_decltype_auto (tree, tree);
extern tree make_template_placeholder (tree);
extern bool template_placeholder_p (tree);
+extern bool ctad_template_p (tree);
extern tree do_auto_deduction (tree, tree, tree,
tsubst_flags_t
= tf_warning_or_error,
extern tree convert_generic_types_to_packs (tree, int, int);
extern tree splice_late_return_type (tree, tree);
extern bool is_auto (const_tree);
-extern tree process_template_parm (tree, location_t, tree,
+extern tree process_template_parm (tree, location_t, tree,
bool, bool);
extern tree end_template_parm_list (tree);
extern void end_template_parm_list (void);
extern tree push_template_decl (tree);
extern tree push_template_decl_real (tree, bool);
extern tree add_inherited_template_parms (tree, tree);
+extern void template_parm_level_and_index (tree, int*, int*);
extern bool redeclare_class_template (tree, tree, tree);
extern tree lookup_template_class (tree, tree, tree, tree,
int, tsubst_flags_t);
extern bool maybe_instantiate_noexcept (tree, tsubst_flags_t = tf_warning_or_error);
extern tree instantiate_decl (tree, bool, bool);
extern int comp_template_parms (const_tree, const_tree);
+extern bool template_heads_equivalent_p (const_tree, const_tree);
extern bool builtin_pack_fn_p (tree);
-extern bool uses_parameter_packs (tree);
+extern tree uses_parameter_packs (tree);
extern bool template_parameter_pack_p (const_tree);
extern bool function_parameter_pack_p (const_tree);
extern bool function_parameter_expanded_from_pack_p (tree, tree);
tree, bool, bool);
extern tree tsubst_expr (tree, tree, tsubst_flags_t,
tree, bool);
-extern tree tsubst_pack_expansion (tree, tree, tsubst_flags_t, tree);
+extern tree tsubst_pack_expansion (tree, tree, tsubst_flags_t, tree);
+extern tree tsubst_argument_pack (tree, tree, tsubst_flags_t, tree);
+extern tree tsubst_template_args (tree, tree, tsubst_flags_t, tree);
+extern tree tsubst_template_arg (tree, tree, tsubst_flags_t, tree);
+extern tree tsubst_function_parms (tree, tree, tsubst_flags_t, tree);
extern tree most_general_template (tree);
extern tree get_mostly_instantiated_function_type (tree);
extern bool problematic_instantiation_changed (void);
extern tree instantiate_non_dependent_or_null (tree);
extern bool variable_template_specialization_p (tree);
extern bool alias_type_or_template_p (tree);
-extern bool alias_template_specialization_p (const_tree);
-extern bool dependent_alias_template_spec_p (const_tree);
+enum { nt_opaque = false, nt_transparent = true };
+extern tree alias_template_specialization_p (const_tree, bool);
+extern tree dependent_alias_template_spec_p (const_tree, bool);
extern bool template_parm_object_p (const_tree);
extern bool explicit_class_specialization_p (tree);
extern bool push_tinst_level (tree);
extern tree get_template_argument_pack_elems (const_tree);
extern tree get_function_template_decl (const_tree);
extern tree resolve_nondeduced_context (tree, tsubst_flags_t);
+extern tree resolve_nondeduced_context_or_error (tree, tsubst_flags_t);
extern hashval_t iterative_hash_template_arg (tree arg, hashval_t val);
extern tree coerce_template_parms (tree, tree, tree);
extern tree coerce_template_parms (tree, tree, tree, tsubst_flags_t);
extern bool copy_guide_p (const_tree);
extern bool template_guide_p (const_tree);
extern void store_explicit_specifier (tree, tree);
-
-/* in repo.c */
-extern void init_repo (void);
-extern int repo_emit_p (tree);
-extern bool repo_export_class_p (const_tree);
-extern void finish_repo (void);
+extern tree add_outermost_template_args (tree, tree);
/* in rtti.c */
/* A vector of all tinfo decls that haven't been emitted yet. */
extern tree get_tinfo_decl (tree);
extern tree get_typeid (tree, tsubst_flags_t);
extern tree build_headof (tree);
-extern tree build_dynamic_cast (tree, tree, tsubst_flags_t);
+extern tree build_dynamic_cast (location_t, tree, tree,
+ tsubst_flags_t);
extern void emit_support_tinfos (void);
extern bool emit_tinfo_decl (tree);
extern tree original_binfo (tree, tree);
extern int shared_member_p (tree);
extern bool any_dependent_bases_p (tree = current_nonlambda_class_type ());
+extern bool maybe_check_overriding_exception_spec (tree, tree);
/* The representation of a deferred access check. */
/* RAII sentinel to ensures that deferred access checks are popped before
a function returns. */
-struct deferring_access_check_sentinel
+class deferring_access_check_sentinel
{
+public:
deferring_access_check_sentinel (enum deferring_kind kind = dk_deferred)
{
push_deferring_access_checks (kind);
extern tree begin_compound_stmt (unsigned int);
extern void finish_compound_stmt (tree);
-extern tree finish_asm_stmt (int, tree, tree, tree, tree,
- tree, bool);
+extern tree finish_asm_stmt (location_t, int, tree, tree,
+ tree, tree, tree, bool);
extern tree finish_label_stmt (tree);
extern void finish_label_decl (tree);
extern cp_expr finish_parenthesized_expr (cp_expr);
-extern tree force_paren_expr (tree);
+extern tree force_paren_expr (tree, bool = false);
+inline tree force_paren_expr_uneval (tree t)
+{ return force_paren_expr (t, true); }
extern tree maybe_undo_parenthesized_ref (tree);
extern tree maybe_strip_ref_conversion (tree);
extern tree finish_non_static_data_member (tree, tree, tree);
extern void finish_static_assert (tree, tree, location_t,
bool);
extern tree finish_decltype_type (tree, bool, tsubst_flags_t);
-extern tree finish_trait_expr (enum cp_trait_kind, tree, tree);
+extern tree finish_trait_expr (location_t, enum cp_trait_kind, tree, tree);
extern tree build_lambda_expr (void);
extern tree build_lambda_object (tree);
extern tree begin_lambda_type (tree);
extern bool is_normal_capture_proxy (tree);
extern bool is_constant_capture_proxy (tree);
extern void register_capture_members (tree);
-extern tree lambda_expr_this_capture (tree, bool);
+extern tree lambda_expr_this_capture (tree, int);
extern void maybe_generic_this_capture (tree, tree);
extern tree maybe_resolve_dummy (tree, bool);
extern tree current_nonlambda_function (void);
extern bool lambda_static_thunk_p (tree);
extern tree finish_builtin_launder (location_t, tree,
tsubst_flags_t);
+extern tree cp_build_vec_convert (tree, location_t, tree,
+ tsubst_flags_t);
extern void start_lambda_scope (tree);
extern void record_lambda_scope (tree);
extern void record_null_lambda_scope (tree);
extern bool trivially_copyable_p (const_tree);
extern bool type_has_unique_obj_representations (const_tree);
extern bool scalarish_type_p (const_tree);
+extern bool structural_type_p (tree, bool = false);
extern bool type_has_nontrivial_default_init (const_tree);
extern bool type_has_nontrivial_copy_init (const_tree);
extern void maybe_warn_parm_abi (tree, location_t);
extern bool check_abi_tag_redeclaration (const_tree, const_tree,
const_tree);
extern bool check_abi_tag_args (tree, tree);
-extern tree strip_typedefs (tree, bool * = NULL);
-extern tree strip_typedefs_expr (tree, bool * = NULL);
+extern tree strip_typedefs (tree, bool * = NULL,
+ unsigned int = 0);
+extern tree strip_typedefs_expr (tree, bool * = NULL,
+ unsigned int = 0);
extern tree copy_binfo (tree, tree, tree,
tree *, int);
extern int member_p (const_tree);
extern tree build_min_non_dep_call_vec (tree, tree, vec<tree, va_gc> *);
extern vec<tree, va_gc>* vec_copy_and_insert (vec<tree, va_gc>*, tree, unsigned);
extern tree build_cplus_new (tree, tree, tsubst_flags_t);
+extern tree build_local_temp (tree);
+extern bool is_local_temp (tree);
extern tree build_aggr_init_expr (tree, tree);
extern tree get_target_expr (tree);
extern tree get_target_expr_sfinae (tree, tsubst_flags_t);
extern bool cv_qualified_p (const_tree);
extern tree cv_unqualified (tree);
extern special_function_kind special_function_p (const_tree);
+extern special_function_kind special_memfn_p (const_tree);
extern int count_trees (tree);
extern int char_type_p (tree);
extern void verify_stmt_tree (tree);
extern void cxx_print_statistics (void);
extern bool maybe_warn_zero_as_null_pointer_constant (tree, location_t);
+/* Analogous to initializer_zerop but also examines the type for
+ which the initializer is being used. Unlike initializer_zerop,
+ considers empty strings to be zero initializers for arrays and
+ non-zero for pointers. */
+extern bool type_initializer_zero_p (tree, tree);
/* in ptree.c */
extern void cxx_print_xnode (FILE *, tree, int);
struct diagnostic_info *);
/* in typeck.c */
+/* Says how we should behave when comparing two arrays one of which
+ has unknown bounds. */
+enum compare_bounds_t { bounds_none, bounds_either, bounds_first };
+
extern bool cxx_mark_addressable (tree, bool = false);
extern int string_conv_p (const_tree, const_tree, int);
-extern tree cp_truthvalue_conversion (tree);
+extern tree cp_truthvalue_conversion (tree, tsubst_flags_t);
+extern tree contextual_conv_bool (tree, tsubst_flags_t);
extern tree condition_conversion (tree);
extern tree require_complete_type (tree);
extern tree require_complete_type_sfinae (tree, tsubst_flags_t);
extern bool comp_except_specs (const_tree, const_tree, int);
extern bool comptypes (tree, tree, int);
extern bool same_type_ignoring_top_level_qualifiers_p (tree, tree);
+extern bool similar_type_p (tree, tree);
extern bool compparms (const_tree, const_tree);
extern int comp_cv_qualification (const_tree, const_tree);
extern int comp_cv_qualification (int, int);
extern int comp_cv_qual_signature (tree, tree);
-extern tree cxx_sizeof_or_alignof_expr (tree, enum tree_code, bool);
-extern tree cxx_sizeof_or_alignof_type (tree, enum tree_code, bool, bool);
+extern tree cxx_sizeof_or_alignof_expr (location_t, tree,
+ enum tree_code, bool);
+extern tree cxx_sizeof_or_alignof_type (location_t, tree,
+ enum tree_code, bool, bool);
extern tree cxx_alignas_expr (tree);
extern tree cxx_sizeof_nowarn (tree);
extern tree is_bitfield_expr_with_lowered_type (const_tree);
tsubst_flags_t);
extern tree finish_class_member_access_expr (cp_expr, tree, bool,
tsubst_flags_t);
+extern tree lookup_destructor (tree, tree, tree, tsubst_flags_t);
extern tree build_x_indirect_ref (location_t, tree,
- ref_operator, tsubst_flags_t);
-extern tree cp_build_indirect_ref (tree, ref_operator,
- tsubst_flags_t);
+ ref_operator,
+ tsubst_flags_t);
+extern tree cp_build_indirect_ref (location_t, tree,
+ ref_operator,
+ tsubst_flags_t);
extern tree cp_build_fold_indirect_ref (tree);
extern tree build_array_ref (location_t, tree, tree);
extern tree cp_build_array_ref (location_t, tree, tree,
extern tree cp_build_function_call_nary (tree, tsubst_flags_t, ...)
ATTRIBUTE_SENTINEL;
extern tree cp_build_function_call_vec (tree, vec<tree, va_gc> **,
- tsubst_flags_t);
+ tsubst_flags_t,
+ tree = NULL_TREE);
extern tree build_x_binary_op (const op_location_t &,
enum tree_code, tree,
enum tree_code, tree,
enum tree_code, tree *,
tsubst_flags_t);
+inline tree build_x_binary_op (const op_location_t &loc,
+ enum tree_code code, tree arg1, tree arg2,
+ tsubst_flags_t complain)
+{
+ return build_x_binary_op (loc, code, arg1, TREE_CODE (arg1), arg2,
+ TREE_CODE (arg2), NULL, complain);
+}
extern tree build_x_array_ref (location_t, tree, tree,
tsubst_flags_t);
extern tree build_x_unary_op (location_t,
tsubst_flags_t);
extern tree genericize_compound_lvalue (tree);
extern tree unary_complex_lvalue (enum tree_code, tree);
-extern tree build_x_conditional_expr (location_t, tree, tree, tree,
+extern tree build_x_conditional_expr (location_t, tree, tree, tree,
tsubst_flags_t);
extern tree build_x_compound_expr_from_list (tree, expr_list_kind,
tsubst_flags_t);
tsubst_flags_t);
extern tree build_compound_expr (location_t, tree, tree);
extern tree cp_build_compound_expr (tree, tree, tsubst_flags_t);
-extern tree build_static_cast (tree, tree, tsubst_flags_t);
-extern tree build_reinterpret_cast (tree, tree, tsubst_flags_t);
-extern tree build_const_cast (tree, tree, tsubst_flags_t);
+extern tree build_static_cast (location_t, tree, tree,
+ tsubst_flags_t);
+extern tree build_reinterpret_cast (location_t, tree, tree,
+ tsubst_flags_t);
+extern tree build_const_cast (location_t, tree, tree,
+ tsubst_flags_t);
extern tree build_c_cast (location_t, tree, tree);
extern cp_expr build_c_cast (location_t loc, tree type,
cp_expr expr);
-extern tree cp_build_c_cast (tree, tree, tsubst_flags_t);
+extern tree cp_build_c_cast (location_t, tree, tree,
+ tsubst_flags_t);
extern cp_expr build_x_modify_expr (location_t, tree,
enum tree_code, tree,
tsubst_flags_t);
impl_conv_rhs, tree, int,
tsubst_flags_t);
extern int comp_ptr_ttypes (tree, tree);
-extern bool comp_ptr_ttypes_const (tree, tree);
+extern bool comp_ptr_ttypes_const (tree, tree, compare_bounds_t);
extern bool error_type_p (const_tree);
extern bool ptr_reasonably_similar (const_tree, const_tree);
extern tree build_ptrmemfunc (tree, tree, int, bool,
extern void expand_ptrmemfunc_cst (tree, tree *, tree *);
extern tree type_after_usual_arithmetic_conversions (tree, tree);
extern tree common_pointer_type (tree, tree);
-extern tree composite_pointer_type (tree, tree, tree, tree,
- composite_pointer_operation,
+extern tree composite_pointer_type (const op_location_t &,
+ tree, tree, tree, tree,
+ composite_pointer_operation,
tsubst_flags_t);
extern tree merge_types (tree, tree);
extern tree strip_array_domain (tree);
extern tree check_return_expr (tree, bool *);
+extern tree spaceship_type (tree, tsubst_flags_t = tf_warning_or_error);
+extern tree genericize_spaceship (tree, tree, tree);
extern tree cp_build_binary_op (const op_location_t &,
enum tree_code, tree, tree,
tsubst_flags_t);
extern tree build_x_vec_perm_expr (location_t,
tree, tree, tree,
tsubst_flags_t);
-#define cxx_sizeof(T) cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, false, true)
+#define cxx_sizeof(T) cxx_sizeof_or_alignof_type (input_location, T, SIZEOF_EXPR, false, true)
extern tree build_simple_component_ref (tree, tree);
extern tree build_ptrmemfunc_access_expr (tree, tree);
extern tree build_address (tree);
extern void check_template_keyword (tree);
extern bool check_raw_literal_operator (const_tree decl);
extern bool check_literal_operator_args (const_tree, bool *, bool *);
-extern void maybe_warn_about_useless_cast (tree, tree, tsubst_flags_t);
+extern void maybe_warn_about_useless_cast (location_t, tree, tree,
+ tsubst_flags_t);
extern tree cp_perform_integral_promotions (tree, tsubst_flags_t);
extern tree finish_left_unary_fold_expr (tree, int);
extern tree finish_right_unary_fold_expr (tree, int);
extern tree finish_binary_fold_expr (tree, tree, int);
extern bool treat_lvalue_as_rvalue_p (tree, bool);
+extern bool decl_in_std_namespace_p (tree);
/* in typeck2.c */
extern void require_complete_eh_spec_types (tree, tree);
return loc;
}
+inline location_t
+cp_expr_loc_or_input_loc (const_tree t)
+{
+ return cp_expr_loc_or_loc (t, input_location);
+}
+
inline void
cxx_incomplete_type_diagnostic (const_tree value, const_tree type,
diagnostic_t diag_kind)
{
- cxx_incomplete_type_diagnostic (cp_expr_loc_or_loc (value, input_location),
+ cxx_incomplete_type_diagnostic (cp_expr_loc_or_input_loc (value),
value, type, diag_kind);
}
extern tree split_nonconstant_init (tree, tree);
extern bool check_narrowing (tree, tree, tsubst_flags_t,
bool = false);
+extern bool ordinary_char_type_p (tree);
extern tree digest_init (tree, tree, tsubst_flags_t);
extern tree digest_init_flags (tree, tree, int, tsubst_flags_t);
extern tree digest_nsdmi_init (tree, tree, tsubst_flags_t);
extern tree build_x_arrow (location_t, tree,
tsubst_flags_t);
extern tree build_m_component_ref (tree, tree, tsubst_flags_t);
-extern tree build_functional_cast (tree, tree, tsubst_flags_t);
+extern tree build_functional_cast (location_t, tree, tree,
+ tsubst_flags_t);
extern tree add_exception_specifier (tree, tree, tsubst_flags_t);
extern tree merge_exception_specifiers (tree, tree);
extern tree cp_fully_fold_init (tree);
extern void clear_fold_cache (void);
extern tree lookup_hotness_attribute (tree);
-extern tree process_stmt_hotness_attribute (tree);
+extern tree process_stmt_hotness_attribute (tree, location_t);
+extern bool simple_empty_class_p (tree, tree, tree_code);
+extern tree fold_builtin_source_location (location_t);
/* in name-lookup.c */
extern tree strip_using_decl (tree);
extern cp_binding_oracle_function *cp_binding_oracle;
+/* Set during diagnostics to record the failed constraint. This is a
+ TREE_LIST whose VALUE is the constraint and whose PURPOSE are the
+ instantiation arguments Defined in pt.c. */
+
+extern tree current_failed_constraint;
+
+/* An RAII class to manage the failed constraint. */
+
+struct diagnosing_failed_constraint
+{
+ diagnosing_failed_constraint (tree, tree, bool);
+ ~diagnosing_failed_constraint ();
+
+ bool diagnosing_error;
+};
+
/* in constraint.cc */
-extern void init_constraint_processing ();
-extern bool constraint_p (tree);
-extern tree conjoin_constraints (tree, tree);
-extern tree conjoin_constraints (tree);
-extern tree get_constraints (tree);
+
+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 combine_constraint_expressions (tree, tree);
+extern tree append_constraint (tree, tree);
+extern tree get_constraints (const_tree);
extern void set_constraints (tree, tree);
extern void remove_constraints (tree);
extern tree current_template_constraints (void);
extern tree associate_classtype_constraints (tree);
extern tree build_constraints (tree, tree);
+extern tree get_template_head_requirements (tree);
+extern tree get_trailing_function_requirements (tree);
extern tree get_shorthand_constraints (tree);
-extern tree build_concept_check (tree, tree, tree = NULL_TREE);
+
+extern tree build_concept_id (tree);
+extern tree build_type_constraint (tree, tree, tsubst_flags_t);
+extern tree build_concept_check (tree, tree, tsubst_flags_t);
+extern tree build_concept_check (tree, tree, tree, tsubst_flags_t);
+
+extern tree_pair finish_type_constraints (tree, tree, tsubst_flags_t);
extern tree build_constrained_parameter (tree, tree, tree = NULL_TREE);
-extern tree make_constrained_auto (tree, tree);
extern void placeholder_extract_concept_and_args (tree, tree&, tree&);
extern bool equivalent_placeholder_constraints (tree, tree);
extern hashval_t hash_placeholder_constraint (tree);
extern bool deduce_constrained_parameter (tree, tree&, tree&);
extern tree resolve_constraint_check (tree);
extern tree check_function_concept (tree);
-extern tree finish_template_introduction (tree, tree);
+extern tree finish_template_introduction (tree, tree, location_t loc);
extern bool valid_requirements_p (tree);
extern tree finish_concept_name (tree);
extern tree finish_shorthand_constraint (tree, tree);
-extern tree finish_requires_expr (tree, tree);
-extern tree finish_simple_requirement (tree);
-extern tree finish_type_requirement (tree);
-extern tree finish_compound_requirement (tree, tree, bool);
-extern tree finish_nested_requirement (tree);
+extern tree finish_requires_expr (location_t, tree, tree);
+extern tree finish_simple_requirement (location_t, tree);
+extern tree finish_type_requirement (location_t, tree);
+extern tree finish_compound_requirement (location_t, tree, tree, bool);
+extern tree finish_nested_requirement (location_t, tree);
extern void check_constrained_friend (tree, tree);
extern tree tsubst_requires_expr (tree, tree, tsubst_flags_t, tree);
extern tree tsubst_constraint (tree, tree, tsubst_flags_t, tree);
extern tree tsubst_constraint_info (tree, tree, tsubst_flags_t, tree);
-extern bool function_concept_check_p (tree);
-extern tree normalize_expression (tree);
-extern tree expand_concept (tree, tree);
-extern bool expanding_concept ();
-extern tree evaluate_constraints (tree, tree);
-extern tree evaluate_function_concept (tree, tree);
-extern tree evaluate_variable_concept (tree, tree);
-extern tree evaluate_constraint_expression (tree, tree);
-extern bool constraints_satisfied_p (tree);
-extern bool constraints_satisfied_p (tree, tree);
-extern tree lookup_constraint_satisfaction (tree, tree);
-extern tree memoize_constraint_satisfaction (tree, tree, tree);
-extern tree lookup_concept_satisfaction (tree, tree);
-extern tree memoize_concept_satisfaction (tree, tree, tree);
-extern tree get_concept_expansion (tree, tree);
-extern tree save_concept_expansion (tree, tree, tree);
+extern tree tsubst_parameter_mapping (tree, tree, tsubst_flags_t, tree);
+extern tree get_mapped_args (tree);
+
+struct processing_constraint_expression_sentinel
+{
+ processing_constraint_expression_sentinel ();
+ ~processing_constraint_expression_sentinel ();
+};
+
+extern bool processing_constraint_expression_p ();
+
+extern tree unpack_concept_check (tree);
+extern tree evaluate_concept_check (tree, tsubst_flags_t);
+extern tree satisfy_constraint_expression (tree);
+extern bool constraints_satisfied_p (tree);
+extern bool constraints_satisfied_p (tree, tree);
+extern void clear_satisfaction_cache ();
extern bool* lookup_subsumption_result (tree, tree);
extern bool save_subsumption_result (tree, tree, bool);
-
+extern tree find_template_parameters (tree, int);
extern bool equivalent_constraints (tree, tree);
extern bool equivalently_constrained (tree, tree);
extern bool subsumes_constraints (tree, tree);
-extern bool strictly_subsumes (tree, tree);
+extern bool strictly_subsumes (tree, tree, tree);
+extern bool weakly_subsumes (tree, tree, tree);
extern int more_constrained (tree, tree);
-
+extern bool at_least_as_constrained (tree, tree);
+extern bool constraints_equivalent_p (tree, tree);
+extern bool atomic_constraints_identical_p (tree, tree);
+extern hashval_t iterative_hash_constraint (tree, hashval_t);
+extern hashval_t hash_atomic_constraint (tree);
extern void diagnose_constraints (location_t, tree, tree);
/* in logic.cc */
-extern tree decompose_conclusions (tree);
extern bool subsumes (tree, tree);
/* In class.c */
extern bool require_rvalue_constant_expression (tree);
extern bool require_potential_rvalue_constant_expression (tree);
extern tree cxx_constant_value (tree, tree = NULL_TREE);
+extern void cxx_constant_dtor (tree, tree);
extern tree cxx_constant_init (tree, tree = NULL_TREE);
extern tree maybe_constant_value (tree, tree = NULL_TREE, bool = false);
extern tree maybe_constant_init (tree, tree = NULL_TREE, bool = false);
extern tree fold_non_dependent_expr (tree,
+ tsubst_flags_t = tf_warning_or_error,
+ bool = false, tree = NULL_TREE);
+extern tree fold_non_dependent_init (tree,
tsubst_flags_t = tf_warning_or_error,
bool = false);
extern tree fold_simple (tree);
-extern bool is_sub_constant_expr (tree);
extern bool reduced_constant_expression_p (tree);
extern bool is_instantiation_of_constexpr (tree);
extern bool var_in_constexpr_fn (tree);
extern void explain_invalid_constexpr_fn (tree);
extern vec<tree> cx_error_context (void);
extern tree fold_sizeof_expr (tree);
-extern void clear_cv_and_fold_caches (void);
+extern void clear_cv_and_fold_caches (bool = true);
+extern tree unshare_constructor (tree CXX_MEM_STAT_INFO);
/* In cp-ubsan.c */
extern void cp_ubsan_maybe_instrument_member_call (tree);
return expr == null_node;
}
+/* True iff T is a variable template declaration. */
+inline bool
+variable_template_p (tree t)
+{
+ if (TREE_CODE (t) != TEMPLATE_DECL)
+ return false;
+ if (!PRIMARY_TEMPLATE_P (t))
+ return false;
+ if (tree r = DECL_TEMPLATE_RESULT (t))
+ return VAR_P (r);
+ return false;
+}
+
+/* True iff T is a standard concept definition. This will return
+ true for both the template and underlying declaration. */
+
+inline bool
+standard_concept_p (tree t)
+{
+ if (TREE_CODE (t) == TEMPLATE_DECL)
+ t = DECL_TEMPLATE_RESULT (t);
+ return TREE_CODE (t) == CONCEPT_DECL;
+}
+
+/* True iff T is a variable concept definition. This will return
+ true for both the template and the underlying declaration. */
+
+inline bool
+variable_concept_p (tree t)
+{
+ if (TREE_CODE (t) == TEMPLATE_DECL)
+ t = DECL_TEMPLATE_RESULT (t);
+ return VAR_P (t) && DECL_DECLARED_CONCEPT_P (t);
+}
+
+/* True iff T is a function concept definition or an overload set
+ containing multiple function concepts. This will return true for
+ both the template and the underlying declaration. */
+
+inline bool
+function_concept_p (tree t)
+{
+ if (TREE_CODE (t) == OVERLOAD)
+ t = OVL_FIRST (t);
+ if (TREE_CODE (t) == TEMPLATE_DECL)
+ t = DECL_TEMPLATE_RESULT (t);
+ return TREE_CODE (t) == FUNCTION_DECL && DECL_DECLARED_CONCEPT_P (t);
+}
+
+/* True iff T is a standard, variable, or function concept. */
+
+inline bool
+concept_definition_p (tree t)
+{
+ if (t == error_mark_node)
+ return false;
+
+ /* Adjust for function concept overloads. */
+ if (TREE_CODE (t) == OVERLOAD)
+ t = OVL_FIRST (t);
+
+ /* See through templates. */
+ if (TREE_CODE (t) == TEMPLATE_DECL)
+ t = DECL_TEMPLATE_RESULT (t);
+
+ /* The obvious and easy case. */
+ if (TREE_CODE (t) == CONCEPT_DECL)
+ return true;
+
+ /* Definitely not a concept. */
+ if (!VAR_OR_FUNCTION_DECL_P (t))
+ return false;
+ if (!DECL_LANG_SPECIFIC (t))
+ return false;
+
+ return DECL_DECLARED_CONCEPT_P (t);
+}
+
+/* Same as above, but for const trees. */
+
+inline bool
+concept_definition_p (const_tree t)
+{
+ return concept_definition_p (const_cast<tree> (t));
+}
+
+/* True if t is an expression that checks a concept. */
+
+inline bool
+concept_check_p (const_tree t)
+{
+ if (TREE_CODE (t) == CALL_EXPR)
+ t = CALL_EXPR_FN (t);
+ if (t && TREE_CODE (t) == TEMPLATE_ID_EXPR)
+ return concept_definition_p (TREE_OPERAND (t, 0));
+ return false;
+}
+
#if CHECKING_P
namespace selftest {
extern void run_cp_tests (void);