diff options
Diffstat (limited to 'gcc/cp/cp-tree.h')
-rw-r--r-- | gcc/cp/cp-tree.h | 69 |
1 files changed, 41 insertions, 28 deletions
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index a4b7ae3716d..7ffc929bc97 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -78,6 +78,7 @@ c-common.h, not after. CONVERT_EXPR_VBASE_PATH (in CONVERT_EXPR) OVL_ARG_DEPENDENT (in OVERLOAD) PACK_EXPANSION_LOCAL_P (in *_PACK_EXPANSION) + TINFO_RECHECK_ACCESS_P (in TEMPLATE_INFO) 1: IDENTIFIER_VIRTUAL_P (in IDENTIFIER_NODE) TI_PENDING_TEMPLATE_FLAG. TEMPLATE_PARMS_FOR_INLINE. @@ -249,7 +250,6 @@ struct GTY(()) template_parm_index_s { int index; int level; int orig_level; - int num_siblings; tree decl; }; typedef struct template_parm_index_s template_parm_index; @@ -726,6 +726,14 @@ typedef struct qualified_typedef_usage_s qualified_typedef_usage_t; DEF_VEC_O (qualified_typedef_usage_t); DEF_VEC_ALLOC_O (qualified_typedef_usage_t,gc); +/* Non-zero if this template specialization has access violations that + should be rechecked when the function is instantiated outside argument + deduction. */ +#define TINFO_HAS_ACCESS_ERRORS(NODE) \ + (TREE_LANG_FLAG_0 (TEMPLATE_INFO_CHECK (NODE))) +#define FNDECL_HAS_ACCESS_ERRORS(NODE) \ + (TINFO_HAS_ACCESS_ERRORS (DECL_TEMPLATE_INFO (NODE))) + struct GTY(()) tree_template_info { struct tree_common common; VEC(qualified_typedef_usage_t,gc) *typedefs_needing_access_checking; @@ -1941,7 +1949,7 @@ struct GTY(()) lang_decl_fn { unsigned thunk_p : 1; unsigned this_thunk_p : 1; unsigned hidden_friend_p : 1; - /* 1 spare bit. */ + unsigned suppress_implicit_decl : 1; /* For a non-thunk function decl, this is a tree list of friendly classes. For a thunk function decl, it is the @@ -2512,11 +2520,11 @@ struct GTY((variable_size)) lang_decl { /* In a TREE_LIST concatenating using directives, indicate indirect directives */ -#define TREE_INDIRECT_USING(NODE) (TREE_LIST_CHECK (NODE)->base.lang_flag_0) +#define TREE_INDIRECT_USING(NODE) TREE_LANG_FLAG_0 (TREE_LIST_CHECK (NODE)) /* In a TREE_LIST in an attribute list, indicates that the attribute must be applied at instantiation time. */ -#define ATTR_IS_DEPENDENT(NODE) (TREE_LIST_CHECK (NODE)->base.lang_flag_0) +#define ATTR_IS_DEPENDENT(NODE) TREE_LANG_FLAG_0 (TREE_LIST_CHECK (NODE)) extern tree decl_shadowed_for_var_lookup (tree); extern void decl_shadowed_for_var_insert (tree, tree); @@ -2873,7 +2881,7 @@ extern void decl_shadowed_for_var_insert (tree, tree); arguments will be placed into the beginning of the argument pack, but additional arguments might still be deduced. */ #define ARGUMENT_PACK_INCOMPLETE_P(NODE) \ - TREE_LANG_FLAG_0 (ARGUMENT_PACK_ARGS (NODE)) + TREE_ADDRESSABLE (ARGUMENT_PACK_ARGS (NODE)) /* When ARGUMENT_PACK_INCOMPLETE_P, stores the explicit template arguments used to fill this pack. */ @@ -3108,6 +3116,12 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) #define DECL_HIDDEN_FRIEND_P(NODE) \ (LANG_DECL_FN_CHECK (DECL_COMMON_CHECK (NODE))->hidden_friend_p) +/* Nonzero if NODE is a FUNCTION_DECL generated by implicitly_declare_fn + that we shouldn't actually declare implicitly; it is only used for + comparing to an =default declaration. */ +#define FNDECL_SUPPRESS_IMPLICIT_DECL(NODE) \ + (LANG_DECL_FN_CHECK (DECL_COMMON_CHECK (NODE))->suppress_implicit_decl) + /* Nonzero if DECL has been declared threadprivate by #pragma omp threadprivate. */ #define CP_DECL_THREADPRIVATE_P(DECL) \ @@ -3705,7 +3719,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) /* Nonzero for a NODE which declares a type. */ #define DECL_DECLARES_TYPE_P(NODE) \ - (TREE_CODE (NODE) == TYPE_DECL || DECL_CLASS_TEMPLATE_P (NODE)) + (TREE_CODE (NODE) == TYPE_DECL || DECL_TYPE_TEMPLATE_P (NODE)) /* Nonzero if NODE declares a function. */ #define DECL_DECLARES_FUNCTION_P(NODE) \ @@ -4156,8 +4170,6 @@ enum tsubst_flags { conversion might be permissible, not actually performing the conversion. */ - tf_no_access_control = 1 << 7, /* Do not perform access checks, even - when issuing other errors. */ tf_partial = 1 << 8, /* Doing initial explicit argument substitution in fn_type_unification. */ /* Convenient substitution flags combinations. */ @@ -4419,9 +4431,7 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, TYPENAME_FLAG }; Used by sythesized_method_walk to determine which functions will be called to initialize subobjects, in order to determine exception specification and possible implicit delete. - This is kind of a hack, but since access control doesn't respect SFINAE - we can't just use tf_none to avoid access control errors, we need - another mechanism. Exiting early also avoids problems with trying + This is kind of a hack, but exiting early avoids problems with trying to perform argument conversions when the class isn't complete yet. */ #define LOOKUP_SPECULATIVE (LOOKUP_LIST_ONLY << 1) /* Used by calls from defaulted functions to limit the overload set to avoid @@ -4523,9 +4533,6 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, TYPENAME_FLAG }; ((template_parm_index*)TEMPLATE_PARM_INDEX_CHECK (NODE)) #define TEMPLATE_PARM_IDX(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->index) #define TEMPLATE_PARM_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->level) -/* The Number of sibling parms this template parm has. */ -#define TEMPLATE_PARM_NUM_SIBLINGS(NODE) \ - (TEMPLATE_PARM_INDEX_CAST (NODE)->num_siblings) #define TEMPLATE_PARM_DESCENDANTS(NODE) (TREE_CHAIN (NODE)) #define TEMPLATE_PARM_ORIG_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->orig_level) #define TEMPLATE_PARM_DECL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->decl) @@ -4879,7 +4886,7 @@ extern tree build_user_type_conversion (tree, tree, int, extern tree build_new_function_call (tree, VEC(tree,gc) **, bool, tsubst_flags_t); extern tree build_operator_new_call (tree, VEC(tree,gc) **, tree *, - tree *, tree *, + tree *, tree, tree *, tsubst_flags_t); extern tree build_new_method_call (tree, tree, VEC(tree,gc) **, tree, int, tree *, @@ -4899,7 +4906,8 @@ extern bool can_convert_arg (tree, tree, tree, int, tsubst_flags_t); extern bool can_convert_arg_bad (tree, tree, tree, int, tsubst_flags_t); -extern bool enforce_access (tree, tree, tree); +extern bool enforce_access (tree, tree, tree, + tsubst_flags_t); extern void push_defarg_context (tree); extern void pop_defarg_context (void); extern tree convert_default_arg (tree, tree, tree, int, @@ -5316,12 +5324,11 @@ extern void append_type_to_template_for_access_check (tree, tree, tree, extern tree splice_late_return_type (tree, tree); extern bool is_auto (const_tree); extern tree process_template_parm (tree, location_t, tree, - bool, bool, unsigned); + bool, bool); extern tree end_template_parm_list (tree); -void fixup_template_parms (void); extern void end_template_decl (void); extern tree maybe_update_decl_type (tree, tree); -extern bool check_default_tmpl_args (tree, tree, int, int, int); +extern bool check_default_tmpl_args (tree, tree, bool, bool, int); extern tree push_template_decl (tree); extern tree push_template_decl_real (tree, bool); extern bool redeclare_class_template (tree, tree); @@ -5330,9 +5337,10 @@ extern tree lookup_template_class (tree, tree, tree, tree, extern tree lookup_template_function (tree, tree); extern int uses_template_parms (tree); extern int uses_template_parms_level (tree, int); +extern bool in_template_function (void); extern tree instantiate_class_template (tree); extern tree instantiate_template (tree, tree, tsubst_flags_t); -extern int fn_type_unification (tree, tree, tree, +extern tree fn_type_unification (tree, tree, tree, const tree *, unsigned int, tree, unification_kind_t, int, bool); @@ -5482,6 +5490,8 @@ typedef struct GTY(()) deferred_access_check { tree decl; /* The declaration that should be used in the error message. */ tree diag_decl; + /* The location of this access. */ + location_t loc; } deferred_access_check; DEF_VEC_O(deferred_access_check); DEF_VEC_ALLOC_O(deferred_access_check,gc); @@ -5493,10 +5503,11 @@ extern void stop_deferring_access_checks (void); extern void pop_deferring_access_checks (void); extern VEC (deferred_access_check,gc)* get_deferred_access_checks (void); extern void pop_to_parent_deferring_access_checks (void); -extern void perform_access_checks (VEC (deferred_access_check,gc)*); -extern void perform_deferred_access_checks (void); -extern void perform_or_defer_access_check (tree, tree, tree); -extern bool speculative_access_check (tree, tree, tree, bool); +extern bool perform_access_checks (VEC (deferred_access_check,gc)*, + tsubst_flags_t); +extern bool perform_deferred_access_checks (tsubst_flags_t); +extern bool perform_or_defer_access_check (tree, tree, tree, + tsubst_flags_t); extern int stmts_are_full_exprs_p (void); extern void init_cp_semantics (void); extern tree do_poplevel (tree); @@ -5686,11 +5697,13 @@ extern bool layout_pod_type_p (const_tree); extern bool std_layout_type_p (const_tree); extern bool trivial_type_p (const_tree); extern bool trivially_copyable_p (const_tree); +extern bool scalarish_type_p (const_tree); extern bool type_has_nontrivial_default_init (const_tree); extern bool type_has_nontrivial_copy_init (const_tree); extern bool class_tmpl_impl_spec_p (const_tree); extern int zero_init_p (const_tree); extern tree strip_typedefs (tree); +extern tree strip_typedefs_expr (tree); extern tree copy_binfo (tree, tree, tree, tree *, int); extern int member_p (const_tree); @@ -5762,10 +5775,10 @@ extern linkage_kind decl_linkage (tree); extern duration_kind decl_storage_duration (tree); extern tree cp_walk_subtrees (tree*, int*, walk_tree_fn, void*, struct pointer_set_t*); -#define cp_walk_tree(a,b,c,d) \ - walk_tree_1 (a, b, c, d, cp_walk_subtrees) -#define cp_walk_tree_without_duplicates(a,b,c) \ - walk_tree_without_duplicates_1 (a, b, c, cp_walk_subtrees) +#define cp_walk_tree(tp,func,data,pset) \ + walk_tree_1 (tp, func, data, pset, cp_walk_subtrees) +#define cp_walk_tree_without_duplicates(tp,func,data) \ + walk_tree_without_duplicates_1 (tp, func, data, cp_walk_subtrees) extern tree fold_if_not_in_template (tree); extern tree rvalue (tree); extern tree convert_bitfield_to_declared_type (tree); |