File: | build/gcc/vec.h |
Warning: | line 815, column 10 Called C++ object pointer is null |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* Functions related to invoking -*- C++ -*- methods and overloaded functions. |
2 | Copyright (C) 1987-2021 Free Software Foundation, Inc. |
3 | Contributed by Michael Tiemann (tiemann@cygnus.com) and |
4 | modified by Brendan Kehoe (brendan@cygnus.com). |
5 | |
6 | This file is part of GCC. |
7 | |
8 | GCC is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 3, or (at your option) |
11 | any later version. |
12 | |
13 | GCC is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with GCC; see the file COPYING3. If not see |
20 | <http://www.gnu.org/licenses/>. */ |
21 | |
22 | |
23 | /* High-level class interface. */ |
24 | |
25 | #include "config.h" |
26 | #include "system.h" |
27 | #include "coretypes.h" |
28 | #include "target.h" |
29 | #include "cp-tree.h" |
30 | #include "timevar.h" |
31 | #include "stringpool.h" |
32 | #include "cgraph.h" |
33 | #include "stor-layout.h" |
34 | #include "trans-mem.h" |
35 | #include "flags.h" |
36 | #include "toplev.h" |
37 | #include "intl.h" |
38 | #include "convert.h" |
39 | #include "langhooks.h" |
40 | #include "c-family/c-objc.h" |
41 | #include "internal-fn.h" |
42 | #include "stringpool.h" |
43 | #include "attribs.h" |
44 | #include "gcc-rich-location.h" |
45 | |
46 | /* The various kinds of conversion. */ |
47 | |
48 | enum conversion_kind { |
49 | ck_identity, |
50 | ck_lvalue, |
51 | ck_fnptr, |
52 | ck_qual, |
53 | ck_std, |
54 | ck_ptr, |
55 | ck_pmem, |
56 | ck_base, |
57 | ck_ref_bind, |
58 | ck_user, |
59 | ck_ambig, |
60 | ck_list, |
61 | ck_aggr, |
62 | ck_rvalue |
63 | }; |
64 | |
65 | /* The rank of the conversion. Order of the enumerals matters; better |
66 | conversions should come earlier in the list. */ |
67 | |
68 | enum conversion_rank { |
69 | cr_identity, |
70 | cr_exact, |
71 | cr_promotion, |
72 | cr_std, |
73 | cr_pbool, |
74 | cr_user, |
75 | cr_ellipsis, |
76 | cr_bad |
77 | }; |
78 | |
79 | /* An implicit conversion sequence, in the sense of [over.best.ics]. |
80 | The first conversion to be performed is at the end of the chain. |
81 | That conversion is always a cr_identity conversion. */ |
82 | |
83 | struct conversion { |
84 | /* The kind of conversion represented by this step. */ |
85 | conversion_kind kind; |
86 | /* The rank of this conversion. */ |
87 | conversion_rank rank; |
88 | BOOL_BITFIELDunsigned int user_conv_p : 1; |
89 | BOOL_BITFIELDunsigned int ellipsis_p : 1; |
90 | BOOL_BITFIELDunsigned int this_p : 1; |
91 | /* True if this conversion would be permitted with a bending of |
92 | language standards, e.g. disregarding pointer qualifiers or |
93 | converting integers to pointers. */ |
94 | BOOL_BITFIELDunsigned int bad_p : 1; |
95 | /* If KIND is ck_ref_bind or ck_base, true to indicate that a |
96 | temporary should be created to hold the result of the |
97 | conversion. If KIND is ck_ambig or ck_user, true means force |
98 | copy-initialization. */ |
99 | BOOL_BITFIELDunsigned int need_temporary_p : 1; |
100 | /* If KIND is ck_ptr or ck_pmem, true to indicate that a conversion |
101 | from a pointer-to-derived to pointer-to-base is being performed. */ |
102 | BOOL_BITFIELDunsigned int base_p : 1; |
103 | /* If KIND is ck_ref_bind, true when either an lvalue reference is |
104 | being bound to an lvalue expression or an rvalue reference is |
105 | being bound to an rvalue expression. If KIND is ck_rvalue or ck_base, |
106 | true when we are treating an lvalue as an rvalue (12.8p33). If |
107 | ck_identity, we will be binding a reference directly or decaying to |
108 | a pointer. */ |
109 | BOOL_BITFIELDunsigned int rvaluedness_matches_p: 1; |
110 | BOOL_BITFIELDunsigned int check_narrowing: 1; |
111 | /* Whether check_narrowing should only check TREE_CONSTANTs; used |
112 | in build_converted_constant_expr. */ |
113 | BOOL_BITFIELDunsigned int check_narrowing_const_only: 1; |
114 | /* True if this conversion is taking place in a copy-initialization context |
115 | and we should only consider converting constructors. Only set in |
116 | ck_base and ck_rvalue. */ |
117 | BOOL_BITFIELDunsigned int copy_init_p : 1; |
118 | /* The type of the expression resulting from the conversion. */ |
119 | tree type; |
120 | union { |
121 | /* The next conversion in the chain. Since the conversions are |
122 | arranged from outermost to innermost, the NEXT conversion will |
123 | actually be performed before this conversion. This variant is |
124 | used only when KIND is neither ck_identity, ck_aggr, ck_ambig nor |
125 | ck_list. Please use the next_conversion function instead |
126 | of using this field directly. */ |
127 | conversion *next; |
128 | /* The expression at the beginning of the conversion chain. This |
129 | variant is used only if KIND is ck_identity, ck_aggr, or ck_ambig. |
130 | You can use conv_get_original_expr to get this expression. */ |
131 | tree expr; |
132 | /* The array of conversions for an initializer_list, so this |
133 | variant is used only when KIN D is ck_list. */ |
134 | conversion **list; |
135 | } u; |
136 | /* The function candidate corresponding to this conversion |
137 | sequence. This field is only used if KIND is ck_user. */ |
138 | struct z_candidate *cand; |
139 | }; |
140 | |
141 | #define CONVERSION_RANK(NODE)((NODE)->bad_p ? cr_bad : (NODE)->ellipsis_p ? cr_ellipsis : (NODE)->user_conv_p ? cr_user : (NODE)->rank) \ |
142 | ((NODE)->bad_p ? cr_bad \ |
143 | : (NODE)->ellipsis_p ? cr_ellipsis \ |
144 | : (NODE)->user_conv_p ? cr_user \ |
145 | : (NODE)->rank) |
146 | |
147 | #define BAD_CONVERSION_RANK(NODE)((NODE)->ellipsis_p ? cr_ellipsis : (NODE)->user_conv_p ? cr_user : (NODE)->rank) \ |
148 | ((NODE)->ellipsis_p ? cr_ellipsis \ |
149 | : (NODE)->user_conv_p ? cr_user \ |
150 | : (NODE)->rank) |
151 | |
152 | static struct obstack conversion_obstack; |
153 | static bool conversion_obstack_initialized; |
154 | struct rejection_reason; |
155 | |
156 | static struct z_candidate * tourney (struct z_candidate *, tsubst_flags_t); |
157 | static int equal_functions (tree, tree); |
158 | static int joust (struct z_candidate *, struct z_candidate *, bool, |
159 | tsubst_flags_t); |
160 | static int compare_ics (conversion *, conversion *); |
161 | static void maybe_warn_class_memaccess (location_t, tree, |
162 | const vec<tree, va_gc> *); |
163 | static tree build_over_call (struct z_candidate *, int, tsubst_flags_t); |
164 | static tree convert_like (conversion *, tree, tsubst_flags_t); |
165 | static tree convert_like_with_context (conversion *, tree, tree, int, |
166 | tsubst_flags_t); |
167 | static void op_error (const op_location_t &, enum tree_code, enum tree_code, |
168 | tree, tree, tree, bool); |
169 | static struct z_candidate *build_user_type_conversion_1 (tree, tree, int, |
170 | tsubst_flags_t); |
171 | static void print_z_candidate (location_t, const char *, struct z_candidate *); |
172 | static void print_z_candidates (location_t, struct z_candidate *); |
173 | static tree build_this (tree); |
174 | static struct z_candidate *splice_viable (struct z_candidate *, bool, bool *); |
175 | static bool any_strictly_viable (struct z_candidate *); |
176 | static struct z_candidate *add_template_candidate |
177 | (struct z_candidate **, tree, tree, tree, tree, const vec<tree, va_gc> *, |
178 | tree, tree, tree, int, unification_kind_t, tsubst_flags_t); |
179 | static struct z_candidate *add_template_candidate_real |
180 | (struct z_candidate **, tree, tree, tree, tree, const vec<tree, va_gc> *, |
181 | tree, tree, tree, int, tree, unification_kind_t, tsubst_flags_t); |
182 | static bool is_complete (tree); |
183 | static struct z_candidate *add_conv_candidate |
184 | (struct z_candidate **, tree, tree, const vec<tree, va_gc> *, tree, |
185 | tree, tsubst_flags_t); |
186 | static struct z_candidate *add_function_candidate |
187 | (struct z_candidate **, tree, tree, tree, const vec<tree, va_gc> *, tree, |
188 | tree, int, conversion**, tsubst_flags_t); |
189 | static conversion *implicit_conversion (tree, tree, tree, bool, int, |
190 | tsubst_flags_t); |
191 | static conversion *reference_binding (tree, tree, tree, bool, int, |
192 | tsubst_flags_t); |
193 | static conversion *build_conv (conversion_kind, tree, conversion *); |
194 | static conversion *build_list_conv (tree, tree, int, tsubst_flags_t); |
195 | static conversion *next_conversion (conversion *); |
196 | static bool is_subseq (conversion *, conversion *); |
197 | static conversion *maybe_handle_ref_bind (conversion **); |
198 | static void maybe_handle_implicit_object (conversion **); |
199 | static struct z_candidate *add_candidate |
200 | (struct z_candidate **, tree, tree, const vec<tree, va_gc> *, size_t, |
201 | conversion **, tree, tree, int, struct rejection_reason *, int); |
202 | static tree source_type (conversion *); |
203 | static void add_warning (struct z_candidate *, struct z_candidate *); |
204 | static conversion *direct_reference_binding (tree, conversion *); |
205 | static bool promoted_arithmetic_type_p (tree); |
206 | static conversion *conditional_conversion (tree, tree, tsubst_flags_t); |
207 | static char *name_as_c_string (tree, tree, bool *); |
208 | static tree prep_operand (tree); |
209 | static void add_candidates (tree, tree, const vec<tree, va_gc> *, tree, tree, |
210 | bool, tree, tree, int, struct z_candidate **, |
211 | tsubst_flags_t); |
212 | static conversion *merge_conversion_sequences (conversion *, conversion *); |
213 | static tree build_temp (tree, tree, int, diagnostic_t *, tsubst_flags_t); |
214 | static conversion *build_identity_conv (tree, tree); |
215 | static inline bool conv_binds_to_array_of_unknown_bound (conversion *); |
216 | static bool conv_is_prvalue (conversion *); |
217 | static tree prevent_lifetime_extension (tree); |
218 | |
219 | /* Returns nonzero iff the destructor name specified in NAME matches BASETYPE. |
220 | NAME can take many forms... */ |
221 | |
222 | bool |
223 | check_dtor_name (tree basetype, tree name) |
224 | { |
225 | /* Just accept something we've already complained about. */ |
226 | if (name == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
227 | return true; |
228 | |
229 | if (TREE_CODE (name)((enum tree_code) (name)->base.code) == TYPE_DECL) |
230 | name = TREE_TYPE (name)((contains_struct_check ((name), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 230, __FUNCTION__))->typed.type); |
231 | else if (TYPE_P (name)(tree_code_type[(int) (((enum tree_code) (name)->base.code ))] == tcc_type)) |
232 | /* OK */; |
233 | else if (identifier_p (name)) |
234 | { |
235 | if ((MAYBE_CLASS_TYPE_P (basetype)((((enum tree_code) (basetype)->base.code) == TEMPLATE_TYPE_PARM || ((enum tree_code) (basetype)->base.code) == TYPENAME_TYPE || ((enum tree_code) (basetype)->base.code) == TYPEOF_TYPE || ((enum tree_code) (basetype)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM || ((enum tree_code) (basetype)->base.code) == DECLTYPE_TYPE ) || (((((enum tree_code) (basetype)->base.code)) == RECORD_TYPE || (((enum tree_code) (basetype)->base.code)) == UNION_TYPE ) && ((tree_class_check ((basetype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 235, __FUNCTION__))->type_common.lang_flag_5))) |
236 | || TREE_CODE (basetype)((enum tree_code) (basetype)->base.code) == ENUMERAL_TYPE) |
237 | && name == constructor_name (basetype)) |
238 | return true; |
239 | else |
240 | name = get_type_value (name); |
241 | } |
242 | else |
243 | { |
244 | /* In the case of: |
245 | |
246 | template <class T> struct S { ~S(); }; |
247 | int i; |
248 | i.~S(); |
249 | |
250 | NAME will be a class template. */ |
251 | gcc_assert (DECL_CLASS_TEMPLATE_P (name))((void)(!(((((enum tree_code) (name)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((name), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 251, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((name ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 251, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base .code) == TYPE_DECL) && (((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((name ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 251, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base .code) == TYPE_DECL && ((contains_struct_check ((((struct tree_template_decl *)(const_cast<union tree_node *> (( ((tree_check ((name), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 251, __FUNCTION__, (TEMPLATE_DECL))))))))->result), (TS_DECL_COMMON ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 251, __FUNCTION__))->decl_common.lang_flag_2)))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 251, __FUNCTION__), 0 : 0)); |
252 | return false; |
253 | } |
254 | |
255 | if (!name || name == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
256 | return false; |
257 | return same_type_p (TYPE_MAIN_VARIANT (basetype), TYPE_MAIN_VARIANT (name))comptypes ((((tree_class_check ((basetype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 257, __FUNCTION__))->type_common.main_variant)), (((tree_class_check ((name), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 257, __FUNCTION__))->type_common.main_variant)), 0); |
258 | } |
259 | |
260 | /* We want the address of a function or method. We avoid creating a |
261 | pointer-to-member function. */ |
262 | |
263 | tree |
264 | build_addr_func (tree function, tsubst_flags_t complain) |
265 | { |
266 | tree type = TREE_TYPE (function)((contains_struct_check ((function), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 266, __FUNCTION__))->typed.type); |
267 | |
268 | /* We have to do these by hand to avoid real pointer to member |
269 | functions. */ |
270 | if (TREE_CODE (type)((enum tree_code) (type)->base.code) == METHOD_TYPE) |
271 | { |
272 | if (TREE_CODE (function)((enum tree_code) (function)->base.code) == OFFSET_REF) |
273 | { |
274 | tree object = build_address (TREE_OPERAND (function, 0)(*((const_cast<tree*> (tree_operand_check ((function), ( 0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 274, __FUNCTION__)))))); |
275 | return get_member_function_from_ptrfunc (&object, |
276 | TREE_OPERAND (function, 1)(*((const_cast<tree*> (tree_operand_check ((function), ( 1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 276, __FUNCTION__))))), |
277 | complain); |
278 | } |
279 | function = build_address (function); |
280 | } |
281 | else if (TREE_CODE (function)((enum tree_code) (function)->base.code) == FUNCTION_DECL |
282 | && DECL_IMMEDIATE_FUNCTION_P (function)(((contains_struct_check (((tree_check (((((enum tree_code) ( function)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((function ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 282, __FUNCTION__, (TEMPLATE_DECL))))))))->result : function )), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 282, __FUNCTION__, (FUNCTION_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 282, __FUNCTION__))->decl_common.lang_specific) ? __extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code ) (function)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((function ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 282, __FUNCTION__, (TEMPLATE_DECL))))))))->result : function )), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 282, __FUNCTION__))->decl_common.lang_specific); if (!(( (enum tree_code) (function)->base.code) == FUNCTION_DECL || (((enum tree_code) (function)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((function), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 282, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((function ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 282, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base .code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 282, __FUNCTION__); <->u.fn; })->immediate_fn_p : false)) |
283 | function = build_address (function); |
284 | else |
285 | function = decay_conversion (function, complain, /*reject_builtin=*/false); |
286 | |
287 | return function; |
288 | } |
289 | |
290 | /* Build a CALL_EXPR, we can handle FUNCTION_TYPEs, METHOD_TYPEs, or |
291 | POINTER_TYPE to those. Note, pointer to member function types |
292 | (TYPE_PTRMEMFUNC_P) must be handled by our callers. There are |
293 | two variants. build_call_a is the primitive taking an array of |
294 | arguments, while build_call_n is a wrapper that handles varargs. */ |
295 | |
296 | tree |
297 | build_call_n (tree function, int n, ...) |
298 | { |
299 | if (n == 0) |
300 | return build_call_a (function, 0, NULL__null); |
301 | else |
302 | { |
303 | tree *argarray = XALLOCAVEC (tree, n)((tree *) __builtin_alloca(sizeof (tree) * (n))); |
304 | va_list ap; |
305 | int i; |
306 | |
307 | va_start (ap, n)__builtin_va_start(ap, n); |
308 | for (i = 0; i < n; i++) |
309 | argarray[i] = va_arg (ap, tree)__builtin_va_arg(ap, tree); |
310 | va_end (ap)__builtin_va_end(ap); |
311 | return build_call_a (function, n, argarray); |
312 | } |
313 | } |
314 | |
315 | /* Update various flags in cfun and the call itself based on what is being |
316 | called. Split out of build_call_a so that bot_manip can use it too. */ |
317 | |
318 | void |
319 | set_flags_from_callee (tree call) |
320 | { |
321 | /* Handle both CALL_EXPRs and AGGR_INIT_EXPRs. */ |
322 | tree decl = cp_get_callee_fndecl_nofold (call); |
323 | |
324 | /* We check both the decl and the type; a function may be known not to |
325 | throw without being declared throw(). */ |
326 | bool nothrow = decl && TREE_NOTHROW (decl)((decl)->base.nothrow_flag); |
327 | tree callee = cp_get_callee (call); |
328 | if (callee) |
329 | nothrow |= TYPE_NOTHROW_P (TREE_TYPE (TREE_TYPE (callee)))nothrow_spec_p (((tree_class_check (((tree_check2 ((((contains_struct_check ((((contains_struct_check ((callee), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 329, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 329, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 329, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))), (tcc_type ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 329, __FUNCTION__))->type_non_common.lang_1)); |
330 | else if (TREE_CODE (call)((enum tree_code) (call)->base.code) == CALL_EXPR |
331 | && internal_fn_flags (CALL_EXPR_IFN (call)((tree_check ((call), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 331, __FUNCTION__, (CALL_EXPR)))->base.u.ifn)) & ECF_NOTHROW(1 << 6)) |
332 | nothrow = true; |
333 | |
334 | if (cfun(cfun + 0) && cp_function_chain((cfun + 0)->language) && !cp_unevaluated_operand) |
335 | { |
336 | if (!nothrow && at_function_scope_p ()) |
337 | cp_function_chain((cfun + 0)->language)->can_throw = 1; |
338 | |
339 | if (decl && TREE_THIS_VOLATILE (decl)((decl)->base.volatile_flag)) |
340 | current_function_returns_abnormally((cfun + 0)->language)->returns_abnormally = 1; |
341 | } |
342 | |
343 | TREE_NOTHROW (call)((call)->base.nothrow_flag) = nothrow; |
344 | } |
345 | |
346 | tree |
347 | build_call_a (tree function, int n, tree *argarray) |
348 | { |
349 | tree decl; |
350 | tree result_type; |
351 | tree fntype; |
352 | int i; |
353 | |
354 | function = build_addr_func (function, tf_warning_or_error); |
355 | |
356 | gcc_assert (TYPE_PTR_P (TREE_TYPE (function)))((void)(!((((enum tree_code) (((contains_struct_check ((function ), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 356, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE )) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 356, __FUNCTION__), 0 : 0)); |
357 | fntype = TREE_TYPE (TREE_TYPE (function))((contains_struct_check ((((contains_struct_check ((function) , (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 357, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 357, __FUNCTION__))->typed.type); |
358 | gcc_assert (FUNC_OR_METHOD_TYPE_P (fntype))((void)(!((((enum tree_code) (fntype)->base.code) == FUNCTION_TYPE || ((enum tree_code) (fntype)->base.code) == METHOD_TYPE) ) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 358, __FUNCTION__), 0 : 0)); |
359 | result_type = TREE_TYPE (fntype)((contains_struct_check ((fntype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 359, __FUNCTION__))->typed.type); |
360 | /* An rvalue has no cv-qualifiers. */ |
361 | if (SCALAR_TYPE_P (result_type)((((enum tree_code) (result_type)->base.code) == OFFSET_TYPE ) || ((enum tree_code) (result_type)->base.code) == ENUMERAL_TYPE || ((((enum tree_code) (result_type)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (result_type)->base.code) == INTEGER_TYPE ) || ((enum tree_code) (result_type)->base.code) == REAL_TYPE || ((enum tree_code) (result_type)->base.code) == COMPLEX_TYPE ) || (((enum tree_code) (result_type)->base.code) == POINTER_TYPE ) || (((enum tree_code) (result_type)->base.code) == RECORD_TYPE && (((tree_class_check (((tree_check ((result_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 361, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 361, __FUNCTION__))->type_common.lang_flag_2))) || (((enum tree_code) (result_type)->base.code) == NULLPTR_TYPE)) || VOID_TYPE_P (result_type)(((enum tree_code) (result_type)->base.code) == VOID_TYPE)) |
362 | result_type = cv_unqualified (result_type); |
363 | |
364 | function = build_call_array_loc (input_location, |
365 | result_type, function, n, argarray); |
366 | set_flags_from_callee (function); |
367 | |
368 | decl = get_callee_fndecl (function); |
369 | |
370 | if (decl && !TREE_USED (decl)((decl)->base.used_flag)) |
371 | { |
372 | /* We invoke build_call directly for several library |
373 | functions. These may have been declared normally if |
374 | we're building libgcc, so we can't just check |
375 | DECL_ARTIFICIAL. */ |
376 | gcc_assert (DECL_ARTIFICIAL (decl)((void)(!(((contains_struct_check ((decl), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 376, __FUNCTION__))->decl_common.artificial_flag) || !strncmp (((const char *) (tree_check ((((contains_struct_check ((decl ), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 377, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 377, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str ), "__", 2)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 378, __FUNCTION__), 0 : 0)) |
377 | || !strncmp (IDENTIFIER_POINTER (DECL_NAME (decl)),((void)(!(((contains_struct_check ((decl), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 376, __FUNCTION__))->decl_common.artificial_flag) || !strncmp (((const char *) (tree_check ((((contains_struct_check ((decl ), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 377, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 377, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str ), "__", 2)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 378, __FUNCTION__), 0 : 0)) |
378 | "__", 2))((void)(!(((contains_struct_check ((decl), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 376, __FUNCTION__))->decl_common.artificial_flag) || !strncmp (((const char *) (tree_check ((((contains_struct_check ((decl ), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 377, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 377, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str ), "__", 2)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 378, __FUNCTION__), 0 : 0)); |
379 | mark_used (decl); |
380 | } |
381 | |
382 | require_complete_eh_spec_types (fntype, decl); |
383 | |
384 | TREE_HAS_CONSTRUCTOR (function)(((tree_not_check2 ((function), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 384, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_4)) = (decl && DECL_CONSTRUCTOR_P (decl)((tree_check (((((enum tree_code) (decl)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 384, __FUNCTION__, (TEMPLATE_DECL))))))))->result : decl )), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 384, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor )); |
385 | |
386 | /* Don't pass empty class objects by value. This is useful |
387 | for tags in STL, which are used to control overload resolution. |
388 | We don't need to handle other cases of copying empty classes. */ |
389 | if (!decl || !fndecl_built_in_p (decl)) |
390 | for (i = 0; i < n; i++) |
391 | { |
392 | tree arg = CALL_EXPR_ARG (function, i)(*((const_cast<tree*> (tree_operand_check (((tree_check ((function), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 392, __FUNCTION__, (CALL_EXPR)))), ((i) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 392, __FUNCTION__))))); |
393 | if (is_empty_class (TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 393, __FUNCTION__))->typed.type)) |
394 | && simple_empty_class_p (TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 394, __FUNCTION__))->typed.type), arg, INIT_EXPR)) |
395 | { |
396 | while (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == TARGET_EXPR) |
397 | /* We're disconnecting the initializer from its target, |
398 | don't create a temporary. */ |
399 | arg = TARGET_EXPR_INITIAL (arg)(*(tree_operand_check_code ((arg), (TARGET_EXPR), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 399, __FUNCTION__))); |
400 | tree t = build0 (EMPTY_CLASS_EXPR, TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 400, __FUNCTION__))->typed.type)); |
401 | arg = build2 (COMPOUND_EXPR, TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 401, __FUNCTION__))->typed.type), arg, t); |
402 | CALL_EXPR_ARG (function, i)(*((const_cast<tree*> (tree_operand_check (((tree_check ((function), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 402, __FUNCTION__, (CALL_EXPR)))), ((i) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 402, __FUNCTION__))))) = arg; |
403 | } |
404 | } |
405 | |
406 | return function; |
407 | } |
408 | |
409 | /* New overloading code. */ |
410 | |
411 | struct z_candidate; |
412 | |
413 | struct candidate_warning { |
414 | z_candidate *loser; |
415 | candidate_warning *next; |
416 | }; |
417 | |
418 | /* Information for providing diagnostics about why overloading failed. */ |
419 | |
420 | enum rejection_reason_code { |
421 | rr_none, |
422 | rr_arity, |
423 | rr_explicit_conversion, |
424 | rr_template_conversion, |
425 | rr_arg_conversion, |
426 | rr_bad_arg_conversion, |
427 | rr_template_unification, |
428 | rr_invalid_copy, |
429 | rr_inherited_ctor, |
430 | rr_constraint_failure |
431 | }; |
432 | |
433 | struct conversion_info { |
434 | /* The index of the argument, 0-based. */ |
435 | int n_arg; |
436 | /* The actual argument or its type. */ |
437 | tree from; |
438 | /* The type of the parameter. */ |
439 | tree to_type; |
440 | /* The location of the argument. */ |
441 | location_t loc; |
442 | }; |
443 | |
444 | struct rejection_reason { |
445 | enum rejection_reason_code code; |
446 | union { |
447 | /* Information about an arity mismatch. */ |
448 | struct { |
449 | /* The expected number of arguments. */ |
450 | int expected; |
451 | /* The actual number of arguments in the call. */ |
452 | int actual; |
453 | /* Whether the call was a varargs call. */ |
454 | bool call_varargs_p; |
455 | } arity; |
456 | /* Information about an argument conversion mismatch. */ |
457 | struct conversion_info conversion; |
458 | /* Same, but for bad argument conversions. */ |
459 | struct conversion_info bad_conversion; |
460 | /* Information about template unification failures. These are the |
461 | parameters passed to fn_type_unification. */ |
462 | struct { |
463 | tree tmpl; |
464 | tree explicit_targs; |
465 | int num_targs; |
466 | const tree *args; |
467 | unsigned int nargs; |
468 | tree return_type; |
469 | unification_kind_t strict; |
470 | int flags; |
471 | } template_unification; |
472 | /* Information about template instantiation failures. These are the |
473 | parameters passed to instantiate_template. */ |
474 | struct { |
475 | tree tmpl; |
476 | tree targs; |
477 | } template_instantiation; |
478 | } u; |
479 | }; |
480 | |
481 | struct z_candidate { |
482 | /* The FUNCTION_DECL that will be called if this candidate is |
483 | selected by overload resolution. */ |
484 | tree fn; |
485 | /* If not NULL_TREE, the first argument to use when calling this |
486 | function. */ |
487 | tree first_arg; |
488 | /* The rest of the arguments to use when calling this function. If |
489 | there are no further arguments this may be NULL or it may be an |
490 | empty vector. */ |
491 | const vec<tree, va_gc> *args; |
492 | /* The implicit conversion sequences for each of the arguments to |
493 | FN. */ |
494 | conversion **convs; |
495 | /* The number of implicit conversion sequences. */ |
496 | size_t num_convs; |
497 | /* If FN is a user-defined conversion, the standard conversion |
498 | sequence from the type returned by FN to the desired destination |
499 | type. */ |
500 | conversion *second_conv; |
501 | struct rejection_reason *reason; |
502 | /* If FN is a member function, the binfo indicating the path used to |
503 | qualify the name of FN at the call site. This path is used to |
504 | determine whether or not FN is accessible if it is selected by |
505 | overload resolution. The DECL_CONTEXT of FN will always be a |
506 | (possibly improper) base of this binfo. */ |
507 | tree access_path; |
508 | /* If FN is a non-static member function, the binfo indicating the |
509 | subobject to which the `this' pointer should be converted if FN |
510 | is selected by overload resolution. The type pointed to by |
511 | the `this' pointer must correspond to the most derived class |
512 | indicated by the CONVERSION_PATH. */ |
513 | tree conversion_path; |
514 | tree template_decl; |
515 | tree explicit_targs; |
516 | candidate_warning *warnings; |
517 | z_candidate *next; |
518 | int viable; |
519 | |
520 | /* The flags active in add_candidate. */ |
521 | int flags; |
522 | |
523 | bool rewritten () { return (flags & LOOKUP_REWRITTEN((((((((((((((1 << 6) << 1) << 1) << 1 ) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1)); } |
524 | bool reversed () { return (flags & LOOKUP_REVERSED(((((((((((((((1 << 6) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1 ) << 1) << 1) << 1) << 1) << 1) << 1)); } |
525 | }; |
526 | |
527 | /* Returns true iff T is a null pointer constant in the sense of |
528 | [conv.ptr]. */ |
529 | |
530 | bool |
531 | null_ptr_cst_p (tree t) |
532 | { |
533 | tree type = TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 533, __FUNCTION__))->typed.type); |
534 | |
535 | /* [conv.ptr] |
536 | |
537 | A null pointer constant is an integer literal ([lex.icon]) with value |
538 | zero or a prvalue of type std::nullptr_t. */ |
539 | if (NULLPTR_TYPE_P (type)(((enum tree_code) (type)->base.code) == NULLPTR_TYPE)) |
540 | return true; |
541 | |
542 | if (cxx_dialect >= cxx11) |
543 | { |
544 | STRIP_ANY_LOCATION_WRAPPER (t)(t) = tree_strip_any_location_wrapper ((const_cast<union tree_node *> (((t))))); |
545 | |
546 | /* Core issue 903 says only literal 0 is a null pointer constant. */ |
547 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == INTEGER_CST |
548 | && !TREE_OVERFLOW (t)((tree_class_check ((t), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 548, __FUNCTION__))->base.public_flag) |
549 | && TREE_CODE (type)((enum tree_code) (type)->base.code) == INTEGER_TYPE |
550 | && integer_zerop (t) |
551 | && !char_type_p (type)) |
552 | return true; |
553 | } |
554 | else if (CP_INTEGRAL_TYPE_P (type)(((enum tree_code) (type)->base.code) == BOOLEAN_TYPE || ( (enum tree_code) (type)->base.code) == INTEGER_TYPE)) |
555 | { |
556 | t = fold_non_dependent_expr (t, tf_none); |
557 | STRIP_NOPS (t)(t) = tree_strip_nop_conversions ((const_cast<union tree_node *> (((t))))); |
558 | if (integer_zerop (t) && !TREE_OVERFLOW (t)((tree_class_check ((t), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 558, __FUNCTION__))->base.public_flag)) |
559 | return true; |
560 | } |
561 | |
562 | return false; |
563 | } |
564 | |
565 | /* Returns true iff T is a null member pointer value (4.11). */ |
566 | |
567 | bool |
568 | null_member_pointer_value_p (tree t) |
569 | { |
570 | tree type = TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 570, __FUNCTION__))->typed.type); |
571 | if (!type) |
572 | return false; |
573 | else if (TYPE_PTRMEMFUNC_P (type)(((enum tree_code) (type)->base.code) == RECORD_TYPE && (((tree_class_check (((tree_check ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 573, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 573, __FUNCTION__))->type_common.lang_flag_2)))) |
574 | return (TREE_CODE (t)((enum tree_code) (t)->base.code) == CONSTRUCTOR |
575 | && CONSTRUCTOR_NELTS (t)(vec_safe_length (((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 575, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))) |
576 | && integer_zerop (CONSTRUCTOR_ELT (t, 0)(&(*((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 576, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[0 ])->value)); |
577 | else if (TYPE_PTRDATAMEM_P (type)(((enum tree_code) (type)->base.code) == OFFSET_TYPE)) |
578 | return integer_all_onesp (t); |
579 | else |
580 | return false; |
581 | } |
582 | |
583 | /* Returns nonzero if PARMLIST consists of only default parms, |
584 | ellipsis, and/or undeduced parameter packs. */ |
585 | |
586 | bool |
587 | sufficient_parms_p (const_tree parmlist) |
588 | { |
589 | for (; parmlist && parmlist != void_list_nodeglobal_trees[TI_VOID_LIST_NODE]; |
590 | parmlist = TREE_CHAIN (parmlist)((contains_struct_check ((parmlist), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 590, __FUNCTION__))->common.chain)) |
591 | if (!TREE_PURPOSE (parmlist)((tree_check ((parmlist), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 591, __FUNCTION__, (TREE_LIST)))->list.purpose) |
592 | && !PACK_EXPANSION_P (TREE_VALUE (parmlist))(((enum tree_code) (((tree_check ((parmlist), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 592, __FUNCTION__, (TREE_LIST)))->list.value))->base. code) == TYPE_PACK_EXPANSION || ((enum tree_code) (((tree_check ((parmlist), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 592, __FUNCTION__, (TREE_LIST)))->list.value))->base. code) == EXPR_PACK_EXPANSION)) |
593 | return false; |
594 | return true; |
595 | } |
596 | |
597 | /* Allocate N bytes of memory from the conversion obstack. The memory |
598 | is zeroed before being returned. */ |
599 | |
600 | static void * |
601 | conversion_obstack_alloc (size_t n) |
602 | { |
603 | void *p; |
604 | if (!conversion_obstack_initialized) |
605 | { |
606 | gcc_obstack_init (&conversion_obstack)_obstack_begin (((&conversion_obstack)), (memory_block_pool ::block_size), (0), (mempool_obstack_chunk_alloc), (mempool_obstack_chunk_free )); |
607 | conversion_obstack_initialized = true; |
608 | } |
609 | p = obstack_alloc (&conversion_obstack, n)__extension__ ({ struct obstack *__h = (&conversion_obstack ); __extension__ ({ struct obstack *__o = (__h); size_t __len = ((n)); if (__extension__ ({ struct obstack const *__o1 = ( __o); (size_t) (__o1->chunk_limit - __o1->next_free); } ) < __len) _obstack_newchunk (__o, __len); ((void) ((__o)-> next_free += (__len))); }); __extension__ ({ struct obstack * __o1 = (__h); void *__value = (void *) __o1->object_base; if (__o1->next_free == __value) __o1->maybe_empty_object = 1; __o1->next_free = ((sizeof (ptrdiff_t) < sizeof (void *) ? (__o1->object_base) : (char *) 0) + (((__o1->next_free ) - (sizeof (ptrdiff_t) < sizeof (void *) ? (__o1->object_base ) : (char *) 0) + (__o1->alignment_mask)) & ~(__o1-> alignment_mask))); if ((size_t) (__o1->next_free - (char * ) __o1->chunk) > (size_t) (__o1->chunk_limit - (char *) __o1->chunk)) __o1->next_free = __o1->chunk_limit ; __o1->object_base = __o1->next_free; __value; }); }); |
610 | memset (p, 0, n); |
611 | return p; |
612 | } |
613 | |
614 | /* Allocate rejection reasons. */ |
615 | |
616 | static struct rejection_reason * |
617 | alloc_rejection (enum rejection_reason_code code) |
618 | { |
619 | struct rejection_reason *p; |
620 | p = (struct rejection_reason *) conversion_obstack_alloc (sizeof *p); |
621 | p->code = code; |
622 | return p; |
623 | } |
624 | |
625 | static struct rejection_reason * |
626 | arity_rejection (tree first_arg, int expected, int actual) |
627 | { |
628 | struct rejection_reason *r = alloc_rejection (rr_arity); |
629 | int adjust = first_arg != NULL_TREE(tree) __null; |
630 | r->u.arity.expected = expected - adjust; |
631 | r->u.arity.actual = actual - adjust; |
632 | return r; |
633 | } |
634 | |
635 | static struct rejection_reason * |
636 | arg_conversion_rejection (tree first_arg, int n_arg, tree from, tree to, |
637 | location_t loc) |
638 | { |
639 | struct rejection_reason *r = alloc_rejection (rr_arg_conversion); |
640 | int adjust = first_arg != NULL_TREE(tree) __null; |
641 | r->u.conversion.n_arg = n_arg - adjust; |
642 | r->u.conversion.from = from; |
643 | r->u.conversion.to_type = to; |
644 | r->u.conversion.loc = loc; |
645 | return r; |
646 | } |
647 | |
648 | static struct rejection_reason * |
649 | bad_arg_conversion_rejection (tree first_arg, int n_arg, tree from, tree to, |
650 | location_t loc) |
651 | { |
652 | struct rejection_reason *r = alloc_rejection (rr_bad_arg_conversion); |
653 | int adjust = first_arg != NULL_TREE(tree) __null; |
654 | r->u.bad_conversion.n_arg = n_arg - adjust; |
655 | r->u.bad_conversion.from = from; |
656 | r->u.bad_conversion.to_type = to; |
657 | r->u.bad_conversion.loc = loc; |
658 | return r; |
659 | } |
660 | |
661 | static struct rejection_reason * |
662 | explicit_conversion_rejection (tree from, tree to) |
663 | { |
664 | struct rejection_reason *r = alloc_rejection (rr_explicit_conversion); |
665 | r->u.conversion.n_arg = 0; |
666 | r->u.conversion.from = from; |
667 | r->u.conversion.to_type = to; |
668 | r->u.conversion.loc = UNKNOWN_LOCATION((location_t) 0); |
669 | return r; |
670 | } |
671 | |
672 | static struct rejection_reason * |
673 | template_conversion_rejection (tree from, tree to) |
674 | { |
675 | struct rejection_reason *r = alloc_rejection (rr_template_conversion); |
676 | r->u.conversion.n_arg = 0; |
677 | r->u.conversion.from = from; |
678 | r->u.conversion.to_type = to; |
679 | r->u.conversion.loc = UNKNOWN_LOCATION((location_t) 0); |
680 | return r; |
681 | } |
682 | |
683 | static struct rejection_reason * |
684 | template_unification_rejection (tree tmpl, tree explicit_targs, tree targs, |
685 | const tree *args, unsigned int nargs, |
686 | tree return_type, unification_kind_t strict, |
687 | int flags) |
688 | { |
689 | size_t args_n_bytes = sizeof (*args) * nargs; |
690 | tree *args1 = (tree *) conversion_obstack_alloc (args_n_bytes); |
691 | struct rejection_reason *r = alloc_rejection (rr_template_unification); |
692 | r->u.template_unification.tmpl = tmpl; |
693 | r->u.template_unification.explicit_targs = explicit_targs; |
694 | r->u.template_unification.num_targs = TREE_VEC_LENGTH (targs)((tree_check ((targs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 694, __FUNCTION__, (TREE_VEC)))->base.u.length); |
695 | /* Copy args to our own storage. */ |
696 | memcpy (args1, args, args_n_bytes); |
697 | r->u.template_unification.args = args1; |
698 | r->u.template_unification.nargs = nargs; |
699 | r->u.template_unification.return_type = return_type; |
700 | r->u.template_unification.strict = strict; |
701 | r->u.template_unification.flags = flags; |
702 | return r; |
703 | } |
704 | |
705 | static struct rejection_reason * |
706 | template_unification_error_rejection (void) |
707 | { |
708 | return alloc_rejection (rr_template_unification); |
709 | } |
710 | |
711 | static struct rejection_reason * |
712 | invalid_copy_with_fn_template_rejection (void) |
713 | { |
714 | struct rejection_reason *r = alloc_rejection (rr_invalid_copy); |
715 | return r; |
716 | } |
717 | |
718 | static struct rejection_reason * |
719 | inherited_ctor_rejection (void) |
720 | { |
721 | struct rejection_reason *r = alloc_rejection (rr_inherited_ctor); |
722 | return r; |
723 | } |
724 | |
725 | /* Build a constraint failure record. */ |
726 | |
727 | static struct rejection_reason * |
728 | constraint_failure (void) |
729 | { |
730 | struct rejection_reason *r = alloc_rejection (rr_constraint_failure); |
731 | return r; |
732 | } |
733 | |
734 | /* Dynamically allocate a conversion. */ |
735 | |
736 | static conversion * |
737 | alloc_conversion (conversion_kind kind) |
738 | { |
739 | conversion *c; |
740 | c = (conversion *) conversion_obstack_alloc (sizeof (conversion)); |
741 | c->kind = kind; |
742 | return c; |
743 | } |
744 | |
745 | /* Make sure that all memory on the conversion obstack has been |
746 | freed. */ |
747 | |
748 | void |
749 | validate_conversion_obstack (void) |
750 | { |
751 | if (conversion_obstack_initialized) |
752 | gcc_assert ((obstack_next_free (&conversion_obstack)((void)(!((((void *) (&conversion_obstack)->next_free) == ((void *) (&conversion_obstack)->object_base))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 753, __FUNCTION__), 0 : 0)) |
753 | == obstack_base (&conversion_obstack)))((void)(!((((void *) (&conversion_obstack)->next_free) == ((void *) (&conversion_obstack)->object_base))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 753, __FUNCTION__), 0 : 0)); |
754 | } |
755 | |
756 | /* Dynamically allocate an array of N conversions. */ |
757 | |
758 | static conversion ** |
759 | alloc_conversions (size_t n) |
760 | { |
761 | return (conversion **) conversion_obstack_alloc (n * sizeof (conversion *)); |
762 | } |
763 | |
764 | /* True iff the active member of conversion::u for code CODE is NEXT. */ |
765 | |
766 | static inline bool |
767 | has_next (conversion_kind code) |
768 | { |
769 | return !(code == ck_identity |
770 | || code == ck_ambig |
771 | || code == ck_list |
772 | || code == ck_aggr); |
773 | } |
774 | |
775 | static conversion * |
776 | build_conv (conversion_kind code, tree type, conversion *from) |
777 | { |
778 | conversion *t; |
779 | conversion_rank rank = CONVERSION_RANK (from)((from)->bad_p ? cr_bad : (from)->ellipsis_p ? cr_ellipsis : (from)->user_conv_p ? cr_user : (from)->rank); |
780 | |
781 | /* Only call this function for conversions that use u.next. */ |
782 | gcc_assert (from == NULL || has_next (code))((void)(!(from == __null || has_next (code)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 782, __FUNCTION__), 0 : 0)); |
783 | |
784 | /* Note that the caller is responsible for filling in t->cand for |
785 | user-defined conversions. */ |
786 | t = alloc_conversion (code); |
787 | t->type = type; |
788 | t->u.next = from; |
789 | |
790 | switch (code) |
791 | { |
792 | case ck_ptr: |
793 | case ck_pmem: |
794 | case ck_base: |
795 | case ck_std: |
796 | if (rank < cr_std) |
797 | rank = cr_std; |
798 | break; |
799 | |
800 | case ck_qual: |
801 | case ck_fnptr: |
802 | if (rank < cr_exact) |
803 | rank = cr_exact; |
804 | break; |
805 | |
806 | default: |
807 | break; |
808 | } |
809 | t->rank = rank; |
810 | t->user_conv_p = (code == ck_user || from->user_conv_p); |
811 | t->bad_p = from->bad_p; |
812 | t->base_p = false; |
813 | return t; |
814 | } |
815 | |
816 | /* Represent a conversion from CTOR, a braced-init-list, to TYPE, a |
817 | specialization of std::initializer_list<T>, if such a conversion is |
818 | possible. */ |
819 | |
820 | static conversion * |
821 | build_list_conv (tree type, tree ctor, int flags, tsubst_flags_t complain) |
822 | { |
823 | tree elttype = TREE_VEC_ELT (CLASSTYPE_TI_ARGS (type), 0)(*((const_cast<tree *> (tree_vec_elt_check ((((struct tree_template_info *)(tree_check (((((tree_class_check (((tree_check3 ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 823, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 823, __FUNCTION__))->type_non_common.lang_1))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 823, __FUNCTION__, (TEMPLATE_INFO))))->args), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 823, __FUNCTION__))))); |
824 | unsigned len = CONSTRUCTOR_NELTS (ctor)(vec_safe_length (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 824, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))); |
825 | conversion **subconvs = alloc_conversions (len); |
826 | conversion *t; |
827 | unsigned i; |
828 | tree val; |
829 | |
830 | /* Within a list-initialization we can have more user-defined |
831 | conversions. */ |
832 | flags &= ~LOOKUP_NO_CONVERSION(1 << 4); |
833 | /* But no narrowing conversions. */ |
834 | flags |= LOOKUP_NO_NARROWING(((1 << 6) << 1) << 1); |
835 | |
836 | /* Can't make an array of these types. */ |
837 | if (TYPE_REF_P (elttype)(((enum tree_code) (elttype)->base.code) == REFERENCE_TYPE ) |
838 | || TREE_CODE (elttype)((enum tree_code) (elttype)->base.code) == FUNCTION_TYPE |
839 | || VOID_TYPE_P (elttype)(((enum tree_code) (elttype)->base.code) == VOID_TYPE)) |
840 | return NULL__null; |
841 | |
842 | FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (ctor), i, val)for (i = 0; (i >= vec_safe_length (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 842, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))) ? false : ((val = (*(((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 842, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))[ i].value), true); (i)++) |
843 | { |
844 | conversion *sub |
845 | = implicit_conversion (elttype, TREE_TYPE (val)((contains_struct_check ((val), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 845, __FUNCTION__))->typed.type), val, |
846 | false, flags, complain); |
847 | if (sub == NULL__null) |
848 | return NULL__null; |
849 | |
850 | subconvs[i] = sub; |
851 | } |
852 | |
853 | t = alloc_conversion (ck_list); |
854 | t->type = type; |
855 | t->u.list = subconvs; |
856 | t->rank = cr_exact; |
857 | |
858 | for (i = 0; i < len; ++i) |
859 | { |
860 | conversion *sub = subconvs[i]; |
861 | if (sub->rank > t->rank) |
862 | t->rank = sub->rank; |
863 | if (sub->user_conv_p) |
864 | t->user_conv_p = true; |
865 | if (sub->bad_p) |
866 | t->bad_p = true; |
867 | } |
868 | |
869 | return t; |
870 | } |
871 | |
872 | /* Return the next conversion of the conversion chain (if applicable), |
873 | or NULL otherwise. Please use this function instead of directly |
874 | accessing fields of struct conversion. */ |
875 | |
876 | static conversion * |
877 | next_conversion (conversion *conv) |
878 | { |
879 | if (conv == NULL__null |
880 | || !has_next (conv->kind)) |
881 | return NULL__null; |
882 | return conv->u.next; |
883 | } |
884 | |
885 | /* Strip to the first ck_user, ck_ambig, ck_list, ck_aggr or ck_identity |
886 | encountered. */ |
887 | |
888 | static conversion * |
889 | strip_standard_conversion (conversion *conv) |
890 | { |
891 | while (conv |
892 | && conv->kind != ck_user |
893 | && has_next (conv->kind)) |
894 | conv = next_conversion (conv); |
895 | return conv; |
896 | } |
897 | |
898 | /* Subroutine of build_aggr_conv: check whether CTOR, a braced-init-list, |
899 | is a valid aggregate initializer for array type ATYPE. */ |
900 | |
901 | static bool |
902 | can_convert_array (tree atype, tree ctor, int flags, tsubst_flags_t complain) |
903 | { |
904 | unsigned i; |
905 | tree elttype = TREE_TYPE (atype)((contains_struct_check ((atype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 905, __FUNCTION__))->typed.type); |
906 | for (i = 0; i < CONSTRUCTOR_NELTS (ctor)(vec_safe_length (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 906, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))); ++i) |
907 | { |
908 | tree val = CONSTRUCTOR_ELT (ctor, i)(&(*((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 908, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[i ])->value; |
909 | bool ok; |
910 | if (TREE_CODE (elttype)((enum tree_code) (elttype)->base.code) == ARRAY_TYPE |
911 | && TREE_CODE (val)((enum tree_code) (val)->base.code) == CONSTRUCTOR) |
912 | ok = can_convert_array (elttype, val, flags, complain); |
913 | else |
914 | ok = can_convert_arg (elttype, TREE_TYPE (val)((contains_struct_check ((val), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 914, __FUNCTION__))->typed.type), val, flags, |
915 | complain); |
916 | if (!ok) |
917 | return false; |
918 | } |
919 | return true; |
920 | } |
921 | |
922 | /* Helper for build_aggr_conv. Return true if FIELD is in PSET, or if |
923 | FIELD has ANON_AGGR_TYPE_P and any initializable field in there recursively |
924 | is in PSET. */ |
925 | |
926 | static bool |
927 | field_in_pset (hash_set<tree, true> &pset, tree field) |
928 | { |
929 | if (pset.contains (field)) |
930 | return true; |
931 | if (ANON_AGGR_TYPE_P (TREE_TYPE (field))((((((enum tree_code) (((contains_struct_check ((field), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 931, __FUNCTION__))->typed.type))->base.code)) == RECORD_TYPE || (((enum tree_code) (((contains_struct_check ((field), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 931, __FUNCTION__))->typed.type))->base.code)) == UNION_TYPE ) && ((tree_class_check ((((contains_struct_check ((field ), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 931, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 931, __FUNCTION__))->type_common.lang_flag_5)) && (((tree_class_check ((((contains_struct_check ((field), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 931, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 931, __FUNCTION__))->type_with_lang_specific.lang_specific ))->anon_aggr)) |
932 | for (field = TYPE_FIELDS (TREE_TYPE (field))((tree_check3 ((((contains_struct_check ((field), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 932, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 932, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
933 | field; field = DECL_CHAIN (field)(((contains_struct_check (((contains_struct_check ((field), ( TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 933, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 933, __FUNCTION__))->common.chain))) |
934 | { |
935 | field = next_initializable_field (field); |
936 | if (field == NULL_TREE(tree) __null) |
937 | break; |
938 | if (field_in_pset (pset, field)) |
939 | return true; |
940 | } |
941 | return false; |
942 | } |
943 | |
944 | /* Represent a conversion from CTOR, a braced-init-list, to TYPE, an |
945 | aggregate class, if such a conversion is possible. */ |
946 | |
947 | static conversion * |
948 | build_aggr_conv (tree type, tree ctor, int flags, tsubst_flags_t complain) |
949 | { |
950 | unsigned HOST_WIDE_INTlong i = 0; |
951 | conversion *c; |
952 | tree field = next_initializable_field (TYPE_FIELDS (type)((tree_check3 ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 952, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values)); |
953 | tree empty_ctor = NULL_TREE(tree) __null; |
954 | hash_set<tree, true> pset; |
955 | |
956 | /* We already called reshape_init in implicit_conversion. */ |
957 | |
958 | /* The conversions within the init-list aren't affected by the enclosing |
959 | context; they're always simple copy-initialization. */ |
960 | flags = LOOKUP_IMPLICIT(((1 << 0)) | (1 << 2))|LOOKUP_NO_NARROWING(((1 << 6) << 1) << 1); |
961 | |
962 | /* For designated initializers, verify that each initializer is convertible |
963 | to corresponding TREE_TYPE (ce->index) and mark those FIELD_DECLs as |
964 | visited. In the following loop then ignore already visited |
965 | FIELD_DECLs. */ |
966 | if (CONSTRUCTOR_IS_DESIGNATED_INIT (ctor)(((tree_not_check2 (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 966, __FUNCTION__, (CONSTRUCTOR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 966, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_6))) |
967 | { |
968 | tree idx, val; |
969 | FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (ctor), i, idx, val)for (i = 0; (i >= vec_safe_length (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 969, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))) ? false : (((void) (val = (*((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 969, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[i ].value)), (idx = (*((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 969, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[i ].index), true); (i)++) |
970 | { |
971 | if (idx && TREE_CODE (idx)((enum tree_code) (idx)->base.code) == FIELD_DECL) |
972 | { |
973 | tree ftype = TREE_TYPE (idx)((contains_struct_check ((idx), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 973, __FUNCTION__))->typed.type); |
974 | bool ok; |
975 | |
976 | if (TREE_CODE (ftype)((enum tree_code) (ftype)->base.code) == ARRAY_TYPE |
977 | && TREE_CODE (val)((enum tree_code) (val)->base.code) == CONSTRUCTOR) |
978 | ok = can_convert_array (ftype, val, flags, complain); |
979 | else |
980 | ok = can_convert_arg (ftype, TREE_TYPE (val)((contains_struct_check ((val), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 980, __FUNCTION__))->typed.type), val, flags, |
981 | complain); |
982 | |
983 | if (!ok) |
984 | return NULL__null; |
985 | /* For unions, there should be just one initializer. */ |
986 | if (TREE_CODE (type)((enum tree_code) (type)->base.code) == UNION_TYPE) |
987 | { |
988 | field = NULL_TREE(tree) __null; |
989 | i = 1; |
990 | break; |
991 | } |
992 | pset.add (idx); |
993 | } |
994 | else |
995 | return NULL__null; |
996 | } |
997 | } |
998 | |
999 | for (; field; field = next_initializable_field (DECL_CHAIN (field)(((contains_struct_check (((contains_struct_check ((field), ( TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 999, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 999, __FUNCTION__))->common.chain)))) |
1000 | { |
1001 | tree ftype = TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1001, __FUNCTION__))->typed.type); |
1002 | tree val; |
1003 | bool ok; |
1004 | |
1005 | if (!pset.is_empty () && field_in_pset (pset, field)) |
1006 | continue; |
1007 | if (i < CONSTRUCTOR_NELTS (ctor)(vec_safe_length (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1007, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))) |
1008 | { |
1009 | val = CONSTRUCTOR_ELT (ctor, i)(&(*((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1009, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[ i])->value; |
1010 | ++i; |
1011 | } |
1012 | else if (DECL_INITIAL (field)((contains_struct_check ((field), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1012, __FUNCTION__))->decl_common.initial)) |
1013 | val = get_nsdmi (field, /*ctor*/false, complain); |
1014 | else if (TYPE_REF_P (ftype)(((enum tree_code) (ftype)->base.code) == REFERENCE_TYPE)) |
1015 | /* Value-initialization of reference is ill-formed. */ |
1016 | return NULL__null; |
1017 | else |
1018 | { |
1019 | if (empty_ctor == NULL_TREE(tree) __null) |
1020 | empty_ctor = build_constructor (init_list_type_nodecp_global_trees[CPTI_INIT_LIST_TYPE], NULL__null); |
1021 | val = empty_ctor; |
1022 | } |
1023 | |
1024 | if (TREE_CODE (ftype)((enum tree_code) (ftype)->base.code) == ARRAY_TYPE |
1025 | && TREE_CODE (val)((enum tree_code) (val)->base.code) == CONSTRUCTOR) |
1026 | ok = can_convert_array (ftype, val, flags, complain); |
1027 | else |
1028 | ok = can_convert_arg (ftype, TREE_TYPE (val)((contains_struct_check ((val), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1028, __FUNCTION__))->typed.type), val, flags, |
1029 | complain); |
1030 | |
1031 | if (!ok) |
1032 | return NULL__null; |
1033 | |
1034 | if (TREE_CODE (type)((enum tree_code) (type)->base.code) == UNION_TYPE) |
1035 | break; |
1036 | } |
1037 | |
1038 | if (i < CONSTRUCTOR_NELTS (ctor)(vec_safe_length (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1038, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))) |
1039 | return NULL__null; |
1040 | |
1041 | c = alloc_conversion (ck_aggr); |
1042 | c->type = type; |
1043 | c->rank = cr_exact; |
1044 | c->user_conv_p = true; |
1045 | c->check_narrowing = true; |
1046 | c->u.expr = ctor; |
1047 | return c; |
1048 | } |
1049 | |
1050 | /* Represent a conversion from CTOR, a braced-init-list, to TYPE, an |
1051 | array type, if such a conversion is possible. */ |
1052 | |
1053 | static conversion * |
1054 | build_array_conv (tree type, tree ctor, int flags, tsubst_flags_t complain) |
1055 | { |
1056 | conversion *c; |
1057 | unsigned HOST_WIDE_INTlong len = CONSTRUCTOR_NELTS (ctor)(vec_safe_length (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1057, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))); |
1058 | tree elttype = TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1058, __FUNCTION__))->typed.type); |
1059 | unsigned i; |
1060 | tree val; |
1061 | bool bad = false; |
1062 | bool user = false; |
1063 | enum conversion_rank rank = cr_exact; |
1064 | |
1065 | /* We might need to propagate the size from the element to the array. */ |
1066 | complete_type (type); |
1067 | |
1068 | if (TYPE_DOMAIN (type)((tree_check ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1068, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ) |
1069 | && !variably_modified_type_p (TYPE_DOMAIN (type)((tree_check ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1069, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values ), NULL_TREE(tree) __null)) |
1070 | { |
1071 | unsigned HOST_WIDE_INTlong alen = tree_to_uhwi (array_type_nelts_top (type)); |
1072 | if (alen < len) |
1073 | return NULL__null; |
1074 | } |
1075 | |
1076 | flags = LOOKUP_IMPLICIT(((1 << 0)) | (1 << 2))|LOOKUP_NO_NARROWING(((1 << 6) << 1) << 1); |
1077 | |
1078 | FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (ctor), i, val)for (i = 0; (i >= vec_safe_length (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1078, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))) ? false : ((val = (*(((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1078, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))) [i].value), true); (i)++) |
1079 | { |
1080 | conversion *sub |
1081 | = implicit_conversion (elttype, TREE_TYPE (val)((contains_struct_check ((val), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1081, __FUNCTION__))->typed.type), val, |
1082 | false, flags, complain); |
1083 | if (sub == NULL__null) |
1084 | return NULL__null; |
1085 | |
1086 | if (sub->rank > rank) |
1087 | rank = sub->rank; |
1088 | if (sub->user_conv_p) |
1089 | user = true; |
1090 | if (sub->bad_p) |
1091 | bad = true; |
1092 | } |
1093 | |
1094 | c = alloc_conversion (ck_aggr); |
1095 | c->type = type; |
1096 | c->rank = rank; |
1097 | c->user_conv_p = user; |
1098 | c->bad_p = bad; |
1099 | c->u.expr = ctor; |
1100 | return c; |
1101 | } |
1102 | |
1103 | /* Represent a conversion from CTOR, a braced-init-list, to TYPE, a |
1104 | complex type, if such a conversion is possible. */ |
1105 | |
1106 | static conversion * |
1107 | build_complex_conv (tree type, tree ctor, int flags, |
1108 | tsubst_flags_t complain) |
1109 | { |
1110 | conversion *c; |
1111 | unsigned HOST_WIDE_INTlong len = CONSTRUCTOR_NELTS (ctor)(vec_safe_length (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1111, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))); |
1112 | tree elttype = TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1112, __FUNCTION__))->typed.type); |
1113 | unsigned i; |
1114 | tree val; |
1115 | bool bad = false; |
1116 | bool user = false; |
1117 | enum conversion_rank rank = cr_exact; |
1118 | |
1119 | if (len != 2) |
1120 | return NULL__null; |
1121 | |
1122 | flags = LOOKUP_IMPLICIT(((1 << 0)) | (1 << 2))|LOOKUP_NO_NARROWING(((1 << 6) << 1) << 1); |
1123 | |
1124 | FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (ctor), i, val)for (i = 0; (i >= vec_safe_length (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1124, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))) ? false : ((val = (*(((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1124, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))) [i].value), true); (i)++) |
1125 | { |
1126 | conversion *sub |
1127 | = implicit_conversion (elttype, TREE_TYPE (val)((contains_struct_check ((val), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1127, __FUNCTION__))->typed.type), val, |
1128 | false, flags, complain); |
1129 | if (sub == NULL__null) |
1130 | return NULL__null; |
1131 | |
1132 | if (sub->rank > rank) |
1133 | rank = sub->rank; |
1134 | if (sub->user_conv_p) |
1135 | user = true; |
1136 | if (sub->bad_p) |
1137 | bad = true; |
1138 | } |
1139 | |
1140 | c = alloc_conversion (ck_aggr); |
1141 | c->type = type; |
1142 | c->rank = rank; |
1143 | c->user_conv_p = user; |
1144 | c->bad_p = bad; |
1145 | c->u.expr = ctor; |
1146 | return c; |
1147 | } |
1148 | |
1149 | /* Build a representation of the identity conversion from EXPR to |
1150 | itself. The TYPE should match the type of EXPR, if EXPR is non-NULL. */ |
1151 | |
1152 | static conversion * |
1153 | build_identity_conv (tree type, tree expr) |
1154 | { |
1155 | conversion *c; |
1156 | |
1157 | c = alloc_conversion (ck_identity); |
1158 | c->type = type; |
1159 | c->u.expr = expr; |
1160 | |
1161 | return c; |
1162 | } |
1163 | |
1164 | /* Converting from EXPR to TYPE was ambiguous in the sense that there |
1165 | were multiple user-defined conversions to accomplish the job. |
1166 | Build a conversion that indicates that ambiguity. */ |
1167 | |
1168 | static conversion * |
1169 | build_ambiguous_conv (tree type, tree expr) |
1170 | { |
1171 | conversion *c; |
1172 | |
1173 | c = alloc_conversion (ck_ambig); |
1174 | c->type = type; |
1175 | c->u.expr = expr; |
1176 | |
1177 | return c; |
1178 | } |
1179 | |
1180 | tree |
1181 | strip_top_quals (tree t) |
1182 | { |
1183 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == ARRAY_TYPE) |
1184 | return t; |
1185 | return cp_build_qualified_type (t, 0)cp_build_qualified_type_real ((t), (0), tf_warning_or_error); |
1186 | } |
1187 | |
1188 | /* Returns the standard conversion path (see [conv]) from type FROM to type |
1189 | TO, if any. For proper handling of null pointer constants, you must |
1190 | also pass the expression EXPR to convert from. If C_CAST_P is true, |
1191 | this conversion is coming from a C-style cast. */ |
1192 | |
1193 | static conversion * |
1194 | standard_conversion (tree to, tree from, tree expr, bool c_cast_p, |
1195 | int flags, tsubst_flags_t complain) |
1196 | { |
1197 | enum tree_code fcode, tcode; |
1198 | conversion *conv; |
1199 | bool fromref = false; |
1200 | tree qualified_to; |
1201 | |
1202 | to = non_reference (to); |
1203 | if (TYPE_REF_P (from)(((enum tree_code) (from)->base.code) == REFERENCE_TYPE)) |
1204 | { |
1205 | fromref = true; |
1206 | from = TREE_TYPE (from)((contains_struct_check ((from), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1206, __FUNCTION__))->typed.type); |
1207 | } |
1208 | qualified_to = to; |
1209 | to = strip_top_quals (to); |
1210 | from = strip_top_quals (from); |
1211 | |
1212 | if (expr && type_unknown_p (expr)) |
1213 | { |
1214 | if (TYPE_PTRFN_P (to)((((enum tree_code) (to)->base.code) == POINTER_TYPE) && ((enum tree_code) (((contains_struct_check ((to), (TS_TYPED) , "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1214, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE ) || TYPE_PTRMEMFUNC_P (to)(((enum tree_code) (to)->base.code) == RECORD_TYPE && (((tree_class_check (((tree_check ((to), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1214, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1214, __FUNCTION__))->type_common.lang_flag_2)))) |
1215 | { |
1216 | tsubst_flags_t tflags = tf_conv; |
1217 | expr = instantiate_type (to, expr, tflags); |
1218 | if (expr == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
1219 | return NULL__null; |
1220 | from = TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1220, __FUNCTION__))->typed.type); |
1221 | } |
1222 | else if (TREE_CODE (to)((enum tree_code) (to)->base.code) == BOOLEAN_TYPE) |
1223 | { |
1224 | /* Necessary for eg, TEMPLATE_ID_EXPRs (c++/50961). */ |
1225 | expr = resolve_nondeduced_context (expr, complain); |
1226 | from = TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1226, __FUNCTION__))->typed.type); |
1227 | } |
1228 | } |
1229 | |
1230 | fcode = TREE_CODE (from)((enum tree_code) (from)->base.code); |
1231 | tcode = TREE_CODE (to)((enum tree_code) (to)->base.code); |
1232 | |
1233 | conv = build_identity_conv (from, expr); |
1234 | if (fcode == FUNCTION_TYPE || fcode == ARRAY_TYPE) |
1235 | { |
1236 | from = type_decays_to (from); |
1237 | fcode = TREE_CODE (from)((enum tree_code) (from)->base.code); |
1238 | /* Tell convert_like that we're using the address. */ |
1239 | conv->rvaluedness_matches_p = true; |
1240 | conv = build_conv (ck_lvalue, from, conv); |
1241 | } |
1242 | /* Wrapping a ck_rvalue around a class prvalue (as a result of using |
1243 | obvalue_p) seems odd, since it's already a prvalue, but that's how we |
1244 | express the copy constructor call required by copy-initialization. */ |
1245 | else if (fromref || (expr && obvalue_p (expr))) |
1246 | { |
1247 | if (expr) |
1248 | { |
1249 | tree bitfield_type; |
1250 | bitfield_type = is_bitfield_expr_with_lowered_type (expr); |
1251 | if (bitfield_type) |
1252 | { |
1253 | from = strip_top_quals (bitfield_type); |
1254 | fcode = TREE_CODE (from)((enum tree_code) (from)->base.code); |
1255 | } |
1256 | } |
1257 | conv = build_conv (ck_rvalue, from, conv); |
1258 | if (flags & LOOKUP_PREFER_RVALUE((1 << 6) << 1)) |
1259 | /* Tell convert_like to set LOOKUP_PREFER_RVALUE. */ |
1260 | conv->rvaluedness_matches_p = true; |
1261 | /* If we're performing copy-initialization, remember to skip |
1262 | explicit constructors. */ |
1263 | if (flags & LOOKUP_ONLYCONVERTING(1 << 2)) |
1264 | conv->copy_init_p = true; |
1265 | } |
1266 | |
1267 | /* Allow conversion between `__complex__' data types. */ |
1268 | if (tcode == COMPLEX_TYPE && fcode == COMPLEX_TYPE) |
1269 | { |
1270 | /* The standard conversion sequence to convert FROM to TO is |
1271 | the standard conversion sequence to perform componentwise |
1272 | conversion. */ |
1273 | conversion *part_conv = standard_conversion |
1274 | (TREE_TYPE (to)((contains_struct_check ((to), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1274, __FUNCTION__))->typed.type), TREE_TYPE (from)((contains_struct_check ((from), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1274, __FUNCTION__))->typed.type), NULL_TREE(tree) __null, c_cast_p, flags, |
1275 | complain); |
1276 | |
1277 | if (!part_conv) |
1278 | conv = NULL__null; |
1279 | else if (part_conv->kind == ck_identity) |
1280 | /* Leave conv alone. */; |
1281 | else |
1282 | { |
1283 | conv = build_conv (part_conv->kind, to, conv); |
1284 | conv->rank = part_conv->rank; |
1285 | } |
1286 | |
1287 | return conv; |
1288 | } |
1289 | |
1290 | if (same_type_p (from, to)comptypes ((from), (to), 0)) |
1291 | { |
1292 | if (CLASS_TYPE_P (to)(((((enum tree_code) (to)->base.code)) == RECORD_TYPE || ( ((enum tree_code) (to)->base.code)) == UNION_TYPE) && ((tree_class_check ((to), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1292, __FUNCTION__))->type_common.lang_flag_5)) && conv->kind == ck_rvalue) |
1293 | conv->type = qualified_to; |
1294 | return conv; |
1295 | } |
1296 | |
1297 | /* [conv.ptr] |
1298 | A null pointer constant can be converted to a pointer type; ... A |
1299 | null pointer constant of integral type can be converted to an |
1300 | rvalue of type std::nullptr_t. */ |
1301 | if ((tcode == POINTER_TYPE || TYPE_PTRMEM_P (to)((((enum tree_code) (to)->base.code) == OFFSET_TYPE) || (( (enum tree_code) (to)->base.code) == RECORD_TYPE && (((tree_class_check (((tree_check ((to), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1301, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1301, __FUNCTION__))->type_common.lang_flag_2)))) |
1302 | || NULLPTR_TYPE_P (to)(((enum tree_code) (to)->base.code) == NULLPTR_TYPE)) |
1303 | && ((expr && null_ptr_cst_p (expr)) |
1304 | || NULLPTR_TYPE_P (from)(((enum tree_code) (from)->base.code) == NULLPTR_TYPE))) |
1305 | conv = build_conv (ck_std, to, conv); |
1306 | else if ((tcode == INTEGER_TYPE && fcode == POINTER_TYPE) |
1307 | || (tcode == POINTER_TYPE && fcode == INTEGER_TYPE)) |
1308 | { |
1309 | /* For backwards brain damage compatibility, allow interconversion of |
1310 | pointers and integers with a pedwarn. */ |
1311 | conv = build_conv (ck_std, to, conv); |
1312 | conv->bad_p = true; |
1313 | } |
1314 | else if (UNSCOPED_ENUM_P (to)(((enum tree_code) (to)->base.code) == ENUMERAL_TYPE && !((tree_check ((to), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1314, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag) ) && fcode == INTEGER_TYPE) |
1315 | { |
1316 | /* For backwards brain damage compatibility, allow interconversion of |
1317 | enums and integers with a pedwarn. */ |
1318 | conv = build_conv (ck_std, to, conv); |
1319 | conv->bad_p = true; |
1320 | } |
1321 | else if ((tcode == POINTER_TYPE && fcode == POINTER_TYPE) |
1322 | || (TYPE_PTRDATAMEM_P (to)(((enum tree_code) (to)->base.code) == OFFSET_TYPE) && TYPE_PTRDATAMEM_P (from)(((enum tree_code) (from)->base.code) == OFFSET_TYPE))) |
1323 | { |
1324 | tree to_pointee; |
1325 | tree from_pointee; |
1326 | |
1327 | if (tcode == POINTER_TYPE) |
1328 | { |
1329 | to_pointee = TREE_TYPE (to)((contains_struct_check ((to), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1329, __FUNCTION__))->typed.type); |
1330 | from_pointee = TREE_TYPE (from)((contains_struct_check ((from), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1330, __FUNCTION__))->typed.type); |
1331 | |
1332 | /* Since this is the target of a pointer, it can't have function |
1333 | qualifiers, so any TYPE_QUALS must be for attributes const or |
1334 | noreturn. Strip them. */ |
1335 | if (TREE_CODE (to_pointee)((enum tree_code) (to_pointee)->base.code) == FUNCTION_TYPE |
1336 | && TYPE_QUALS (to_pointee)((int) ((((tree_class_check ((to_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1336, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((to_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1336, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((to_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1336, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((to_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1336, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((to_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1336, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8))))) |
1337 | to_pointee = build_qualified_type (to_pointee, TYPE_UNQUALIFIED); |
1338 | if (TREE_CODE (from_pointee)((enum tree_code) (from_pointee)->base.code) == FUNCTION_TYPE |
1339 | && TYPE_QUALS (from_pointee)((int) ((((tree_class_check ((from_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1339, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((from_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1339, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((from_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1339, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((from_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1339, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((from_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1339, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8))))) |
1340 | from_pointee = build_qualified_type (from_pointee, TYPE_UNQUALIFIED); |
1341 | } |
1342 | else |
1343 | { |
1344 | to_pointee = TYPE_PTRMEM_POINTED_TO_TYPE (to)((((enum tree_code) (to)->base.code) == OFFSET_TYPE) ? ((contains_struct_check ((to), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1344, __FUNCTION__))->typed.type) : ((contains_struct_check (((cp_build_qualified_type_real ((((contains_struct_check (( ((tree_check3 ((to), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1344, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1344, __FUNCTION__))->typed.type)), (cp_type_quals (to)) , tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1344, __FUNCTION__))->typed.type)); |
1345 | from_pointee = TYPE_PTRMEM_POINTED_TO_TYPE (from)((((enum tree_code) (from)->base.code) == OFFSET_TYPE) ? ( (contains_struct_check ((from), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1345, __FUNCTION__))->typed.type) : ((contains_struct_check (((cp_build_qualified_type_real ((((contains_struct_check (( ((tree_check3 ((from), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1345, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1345, __FUNCTION__))->typed.type)), (cp_type_quals (from )), tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1345, __FUNCTION__))->typed.type)); |
1346 | } |
1347 | |
1348 | if (tcode == POINTER_TYPE |
1349 | && same_type_ignoring_top_level_qualifiers_p (from_pointee, |
1350 | to_pointee)) |
1351 | ; |
1352 | else if (VOID_TYPE_P (to_pointee)(((enum tree_code) (to_pointee)->base.code) == VOID_TYPE) |
1353 | && !TYPE_PTRDATAMEM_P (from)(((enum tree_code) (from)->base.code) == OFFSET_TYPE) |
1354 | && TREE_CODE (from_pointee)((enum tree_code) (from_pointee)->base.code) != FUNCTION_TYPE) |
1355 | { |
1356 | tree nfrom = TREE_TYPE (from)((contains_struct_check ((from), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1356, __FUNCTION__))->typed.type); |
1357 | /* Don't try to apply restrict to void. */ |
1358 | int quals = cp_type_quals (nfrom) & ~TYPE_QUAL_RESTRICT; |
1359 | from_pointee = cp_build_qualified_type (void_type_node, quals)cp_build_qualified_type_real ((global_trees[TI_VOID_TYPE]), ( quals), tf_warning_or_error); |
1360 | from = build_pointer_type (from_pointee); |
1361 | conv = build_conv (ck_ptr, from, conv); |
1362 | } |
1363 | else if (TYPE_PTRDATAMEM_P (from)(((enum tree_code) (from)->base.code) == OFFSET_TYPE)) |
1364 | { |
1365 | tree fbase = TYPE_PTRMEM_CLASS_TYPE (from)((((enum tree_code) (from)->base.code) == OFFSET_TYPE) ? ( (tree_check ((from), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1365, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval ) : ((tree_check2 ((((contains_struct_check (((cp_build_qualified_type_real ((((contains_struct_check ((((tree_check3 ((from), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1365, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1365, __FUNCTION__))->typed.type)), (cp_type_quals (from )), tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1365, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1365, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .maxval)); |
1366 | tree tbase = TYPE_PTRMEM_CLASS_TYPE (to)((((enum tree_code) (to)->base.code) == OFFSET_TYPE) ? ((tree_check ((to), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1366, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval ) : ((tree_check2 ((((contains_struct_check (((cp_build_qualified_type_real ((((contains_struct_check ((((tree_check3 ((to), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1366, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1366, __FUNCTION__))->typed.type)), (cp_type_quals (to)) , tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1366, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1366, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .maxval)); |
1367 | |
1368 | if (same_type_p (fbase, tbase)comptypes ((fbase), (tbase), 0)) |
1369 | /* No base conversion needed. */; |
1370 | else if (DERIVED_FROM_P (fbase, tbase)(lookup_base ((tbase), (fbase), ba_any, __null, tf_none) != ( tree) __null) |
1371 | && (same_type_ignoring_top_level_qualifiers_p |
1372 | (from_pointee, to_pointee))) |
1373 | { |
1374 | from = build_ptrmem_type (tbase, from_pointee); |
1375 | conv = build_conv (ck_pmem, from, conv); |
1376 | } |
1377 | else |
1378 | return NULL__null; |
1379 | } |
1380 | else if (CLASS_TYPE_P (from_pointee)(((((enum tree_code) (from_pointee)->base.code)) == RECORD_TYPE || (((enum tree_code) (from_pointee)->base.code)) == UNION_TYPE ) && ((tree_class_check ((from_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1380, __FUNCTION__))->type_common.lang_flag_5)) |
1381 | && CLASS_TYPE_P (to_pointee)(((((enum tree_code) (to_pointee)->base.code)) == RECORD_TYPE || (((enum tree_code) (to_pointee)->base.code)) == UNION_TYPE ) && ((tree_class_check ((to_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1381, __FUNCTION__))->type_common.lang_flag_5)) |
1382 | /* [conv.ptr] |
1383 | |
1384 | An rvalue of type "pointer to cv D," where D is a |
1385 | class type, can be converted to an rvalue of type |
1386 | "pointer to cv B," where B is a base class (clause |
1387 | _class.derived_) of D. If B is an inaccessible |
1388 | (clause _class.access_) or ambiguous |
1389 | (_class.member.lookup_) base class of D, a program |
1390 | that necessitates this conversion is ill-formed. |
1391 | Therefore, we use DERIVED_FROM_P, and do not check |
1392 | access or uniqueness. */ |
1393 | && DERIVED_FROM_P (to_pointee, from_pointee)(lookup_base ((from_pointee), (to_pointee), ba_any, __null, tf_none ) != (tree) __null)) |
1394 | { |
1395 | from_pointee |
1396 | = cp_build_qualified_type (to_pointee,cp_build_qualified_type_real ((to_pointee), (cp_type_quals (from_pointee )), tf_warning_or_error) |
1397 | cp_type_quals (from_pointee))cp_build_qualified_type_real ((to_pointee), (cp_type_quals (from_pointee )), tf_warning_or_error); |
1398 | from = build_pointer_type (from_pointee); |
1399 | conv = build_conv (ck_ptr, from, conv); |
1400 | conv->base_p = true; |
1401 | } |
1402 | |
1403 | if (same_type_p (from, to)comptypes ((from), (to), 0)) |
1404 | /* OK */; |
1405 | else if (c_cast_p && comp_ptr_ttypes_const (to, from, bounds_either)) |
1406 | /* In a C-style cast, we ignore CV-qualification because we |
1407 | are allowed to perform a static_cast followed by a |
1408 | const_cast. */ |
1409 | conv = build_conv (ck_qual, to, conv); |
1410 | else if (!c_cast_p && comp_ptr_ttypes (to_pointee, from_pointee)) |
1411 | conv = build_conv (ck_qual, to, conv); |
1412 | else if (expr && string_conv_p (to, expr, 0)) |
1413 | /* converting from string constant to char *. */ |
1414 | conv = build_conv (ck_qual, to, conv); |
1415 | else if (fnptr_conv_p (to, from)) |
1416 | conv = build_conv (ck_fnptr, to, conv); |
1417 | /* Allow conversions among compatible ObjC pointer types (base |
1418 | conversions have been already handled above). */ |
1419 | else if (c_dialect_objc ()((c_language & clk_objc) != 0) |
1420 | && objc_compare_types (to, from, -4, NULL_TREE(tree) __null)) |
1421 | conv = build_conv (ck_ptr, to, conv); |
1422 | else if (ptr_reasonably_similar (to_pointee, from_pointee)) |
1423 | { |
1424 | conv = build_conv (ck_ptr, to, conv); |
1425 | conv->bad_p = true; |
1426 | } |
1427 | else |
1428 | return NULL__null; |
1429 | |
1430 | from = to; |
1431 | } |
1432 | else if (TYPE_PTRMEMFUNC_P (to)(((enum tree_code) (to)->base.code) == RECORD_TYPE && (((tree_class_check (((tree_check ((to), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1432, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1432, __FUNCTION__))->type_common.lang_flag_2))) && TYPE_PTRMEMFUNC_P (from)(((enum tree_code) (from)->base.code) == RECORD_TYPE && (((tree_class_check (((tree_check ((from), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1432, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1432, __FUNCTION__))->type_common.lang_flag_2)))) |
1433 | { |
1434 | tree fromfn = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (from))((contains_struct_check (((cp_build_qualified_type_real ((((contains_struct_check ((((tree_check3 ((from), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1434, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1434, __FUNCTION__))->typed.type)), (cp_type_quals (from )), tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1434, __FUNCTION__))->typed.type); |
1435 | tree tofn = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (to))((contains_struct_check (((cp_build_qualified_type_real ((((contains_struct_check ((((tree_check3 ((to), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1435, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1435, __FUNCTION__))->typed.type)), (cp_type_quals (to)) , tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1435, __FUNCTION__))->typed.type); |
1436 | tree fbase = class_of_this_parm (fromfn); |
1437 | tree tbase = class_of_this_parm (tofn); |
1438 | |
1439 | if (!DERIVED_FROM_P (fbase, tbase)(lookup_base ((tbase), (fbase), ba_any, __null, tf_none) != ( tree) __null)) |
1440 | return NULL__null; |
1441 | |
1442 | tree fstat = static_fn_type (fromfn); |
1443 | tree tstat = static_fn_type (tofn); |
1444 | if (same_type_p (tstat, fstat)comptypes ((tstat), (fstat), 0) |
1445 | || fnptr_conv_p (tstat, fstat)) |
1446 | /* OK */; |
1447 | else |
1448 | return NULL__null; |
1449 | |
1450 | if (!same_type_p (fbase, tbase)comptypes ((fbase), (tbase), 0)) |
1451 | { |
1452 | from = build_memfn_type (fstat, |
1453 | tbase, |
1454 | cp_type_quals (tbase), |
1455 | type_memfn_rqual (tofn)); |
1456 | from = build_ptrmemfunc_type (build_pointer_type (from)); |
1457 | conv = build_conv (ck_pmem, from, conv); |
1458 | conv->base_p = true; |
1459 | } |
1460 | if (fnptr_conv_p (tstat, fstat)) |
1461 | conv = build_conv (ck_fnptr, to, conv); |
1462 | } |
1463 | else if (tcode == BOOLEAN_TYPE) |
1464 | { |
1465 | /* [conv.bool] |
1466 | |
1467 | A prvalue of arithmetic, unscoped enumeration, pointer, or pointer |
1468 | to member type can be converted to a prvalue of type bool. ... |
1469 | For direct-initialization (8.5 [dcl.init]), a prvalue of type |
1470 | std::nullptr_t can be converted to a prvalue of type bool; */ |
1471 | if (ARITHMETIC_TYPE_P (from)((((enum tree_code) (from)->base.code) == BOOLEAN_TYPE || ( (enum tree_code) (from)->base.code) == INTEGER_TYPE) || (( enum tree_code) (from)->base.code) == REAL_TYPE || ((enum tree_code ) (from)->base.code) == COMPLEX_TYPE) |
1472 | || UNSCOPED_ENUM_P (from)(((enum tree_code) (from)->base.code) == ENUMERAL_TYPE && !((tree_check ((from), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1472, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag) ) |
1473 | || fcode == POINTER_TYPE |
1474 | || TYPE_PTRMEM_P (from)((((enum tree_code) (from)->base.code) == OFFSET_TYPE) || ( ((enum tree_code) (from)->base.code) == RECORD_TYPE && (((tree_class_check (((tree_check ((from), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1474, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1474, __FUNCTION__))->type_common.lang_flag_2)))) |
1475 | || NULLPTR_TYPE_P (from)(((enum tree_code) (from)->base.code) == NULLPTR_TYPE)) |
1476 | { |
1477 | conv = build_conv (ck_std, to, conv); |
1478 | if (fcode == POINTER_TYPE |
1479 | || TYPE_PTRDATAMEM_P (from)(((enum tree_code) (from)->base.code) == OFFSET_TYPE) |
1480 | || (TYPE_PTRMEMFUNC_P (from)(((enum tree_code) (from)->base.code) == RECORD_TYPE && (((tree_class_check (((tree_check ((from), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1480, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1480, __FUNCTION__))->type_common.lang_flag_2))) |
1481 | && conv->rank < cr_pbool) |
1482 | || NULLPTR_TYPE_P (from)(((enum tree_code) (from)->base.code) == NULLPTR_TYPE)) |
1483 | conv->rank = cr_pbool; |
1484 | if (NULLPTR_TYPE_P (from)(((enum tree_code) (from)->base.code) == NULLPTR_TYPE) && (flags & LOOKUP_ONLYCONVERTING(1 << 2))) |
1485 | conv->bad_p = true; |
1486 | if (flags & LOOKUP_NO_NARROWING(((1 << 6) << 1) << 1)) |
1487 | conv->check_narrowing = true; |
1488 | return conv; |
1489 | } |
1490 | |
1491 | return NULL__null; |
1492 | } |
1493 | /* We don't check for ENUMERAL_TYPE here because there are no standard |
1494 | conversions to enum type. */ |
1495 | /* As an extension, allow conversion to complex type. */ |
1496 | else if (ARITHMETIC_TYPE_P (to)((((enum tree_code) (to)->base.code) == BOOLEAN_TYPE || (( enum tree_code) (to)->base.code) == INTEGER_TYPE) || ((enum tree_code) (to)->base.code) == REAL_TYPE || ((enum tree_code ) (to)->base.code) == COMPLEX_TYPE)) |
1497 | { |
1498 | if (! (INTEGRAL_CODE_P (fcode)((fcode) == ENUMERAL_TYPE || (fcode) == BOOLEAN_TYPE || (fcode ) == INTEGER_TYPE) |
1499 | || (fcode == REAL_TYPE && !(flags & LOOKUP_NO_NON_INTEGRAL(((((((((((1 << 6) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1 ) << 1)))) |
1500 | || SCOPED_ENUM_P (from)(((enum tree_code) (from)->base.code) == ENUMERAL_TYPE && ((tree_check ((from), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1500, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag) )) |
1501 | return NULL__null; |
1502 | |
1503 | /* If we're parsing an enum with no fixed underlying type, we're |
1504 | dealing with an incomplete type, which renders the conversion |
1505 | ill-formed. */ |
1506 | if (!COMPLETE_TYPE_P (from)(((tree_class_check ((from), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1506, __FUNCTION__))->type_common.size) != (tree) __null )) |
1507 | return NULL__null; |
1508 | |
1509 | conv = build_conv (ck_std, to, conv); |
1510 | |
1511 | tree underlying_type = NULL_TREE(tree) __null; |
1512 | if (TREE_CODE (from)((enum tree_code) (from)->base.code) == ENUMERAL_TYPE |
1513 | && ENUM_FIXED_UNDERLYING_TYPE_P (from)(((tree_class_check ((from), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1513, __FUNCTION__))->type_common.lang_flag_5))) |
1514 | underlying_type = ENUM_UNDERLYING_TYPE (from)((contains_struct_check (((tree_check ((from), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1514, __FUNCTION__, (ENUMERAL_TYPE)))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1514, __FUNCTION__))->typed.type); |
1515 | |
1516 | /* Give this a better rank if it's a promotion. |
1517 | |
1518 | To handle CWG 1601, also bump the rank if we are converting |
1519 | an enumeration with a fixed underlying type to the underlying |
1520 | type. */ |
1521 | if ((same_type_p (to, type_promotes_to (from))comptypes ((to), (type_promotes_to (from)), 0) |
1522 | || (underlying_type && same_type_p (to, underlying_type)comptypes ((to), (underlying_type), 0))) |
1523 | && next_conversion (conv)->rank <= cr_promotion) |
1524 | conv->rank = cr_promotion; |
1525 | } |
1526 | else if (fcode == VECTOR_TYPE && tcode == VECTOR_TYPE |
1527 | && vector_types_convertible_p (from, to, false)) |
1528 | return build_conv (ck_std, to, conv); |
1529 | else if (MAYBE_CLASS_TYPE_P (to)((((enum tree_code) (to)->base.code) == TEMPLATE_TYPE_PARM || ((enum tree_code) (to)->base.code) == TYPENAME_TYPE || ((enum tree_code) (to)->base.code) == TYPEOF_TYPE || ((enum tree_code) (to)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM || ((enum tree_code) (to)->base.code) == DECLTYPE_TYPE) || (((((enum tree_code) (to)->base.code)) == RECORD_TYPE || ( ((enum tree_code) (to)->base.code)) == UNION_TYPE) && ((tree_class_check ((to), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1529, __FUNCTION__))->type_common.lang_flag_5))) && MAYBE_CLASS_TYPE_P (from)((((enum tree_code) (from)->base.code) == TEMPLATE_TYPE_PARM || ((enum tree_code) (from)->base.code) == TYPENAME_TYPE || ((enum tree_code) (from)->base.code) == TYPEOF_TYPE || (( enum tree_code) (from)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM || ((enum tree_code) (from)->base.code) == DECLTYPE_TYPE) || (((((enum tree_code) (from)->base.code)) == RECORD_TYPE || (((enum tree_code) (from)->base.code)) == UNION_TYPE) && ((tree_class_check ((from), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1529, __FUNCTION__))->type_common.lang_flag_5))) |
1530 | && is_properly_derived_from (from, to)) |
1531 | { |
1532 | if (conv->kind == ck_rvalue) |
1533 | conv = next_conversion (conv); |
1534 | conv = build_conv (ck_base, to, conv); |
1535 | /* The derived-to-base conversion indicates the initialization |
1536 | of a parameter with base type from an object of a derived |
1537 | type. A temporary object is created to hold the result of |
1538 | the conversion unless we're binding directly to a reference. */ |
1539 | conv->need_temporary_p = !(flags & LOOKUP_NO_TEMP_BIND(1 << 6)); |
1540 | if (flags & LOOKUP_PREFER_RVALUE((1 << 6) << 1)) |
1541 | /* Tell convert_like to set LOOKUP_PREFER_RVALUE. */ |
1542 | conv->rvaluedness_matches_p = true; |
1543 | /* If we're performing copy-initialization, remember to skip |
1544 | explicit constructors. */ |
1545 | if (flags & LOOKUP_ONLYCONVERTING(1 << 2)) |
1546 | conv->copy_init_p = true; |
1547 | } |
1548 | else |
1549 | return NULL__null; |
1550 | |
1551 | if (flags & LOOKUP_NO_NARROWING(((1 << 6) << 1) << 1)) |
1552 | conv->check_narrowing = true; |
1553 | |
1554 | return conv; |
1555 | } |
1556 | |
1557 | /* Returns nonzero if T1 is reference-related to T2. */ |
1558 | |
1559 | bool |
1560 | reference_related_p (tree t1, tree t2) |
1561 | { |
1562 | if (t1 == error_mark_nodeglobal_trees[TI_ERROR_MARK] || t2 == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
1563 | return false; |
1564 | |
1565 | t1 = TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1565, __FUNCTION__))->type_common.main_variant); |
1566 | t2 = TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1566, __FUNCTION__))->type_common.main_variant); |
1567 | |
1568 | /* [dcl.init.ref] |
1569 | |
1570 | Given types "cv1 T1" and "cv2 T2," "cv1 T1" is reference-related |
1571 | to "cv2 T2" if T1 is similar to T2, or T1 is a base class of T2. */ |
1572 | return (similar_type_p (t1, t2) |
1573 | || (CLASS_TYPE_P (t1)(((((enum tree_code) (t1)->base.code)) == RECORD_TYPE || ( ((enum tree_code) (t1)->base.code)) == UNION_TYPE) && ((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1573, __FUNCTION__))->type_common.lang_flag_5)) && CLASS_TYPE_P (t2)(((((enum tree_code) (t2)->base.code)) == RECORD_TYPE || ( ((enum tree_code) (t2)->base.code)) == UNION_TYPE) && ((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1573, __FUNCTION__))->type_common.lang_flag_5)) |
1574 | && DERIVED_FROM_P (t1, t2)(lookup_base ((t2), (t1), ba_any, __null, tf_none) != (tree) __null ))); |
1575 | } |
1576 | |
1577 | /* Returns nonzero if T1 is reference-compatible with T2. */ |
1578 | |
1579 | bool |
1580 | reference_compatible_p (tree t1, tree t2) |
1581 | { |
1582 | /* [dcl.init.ref] |
1583 | |
1584 | "cv1 T1" is reference compatible with "cv2 T2" if |
1585 | a prvalue of type "pointer to cv2 T2" can be converted to the type |
1586 | "pointer to cv1 T1" via a standard conversion sequence. */ |
1587 | tree ptype1 = build_pointer_type (t1); |
1588 | tree ptype2 = build_pointer_type (t2); |
1589 | conversion *conv = standard_conversion (ptype1, ptype2, NULL_TREE(tree) __null, |
1590 | /*c_cast_p=*/false, 0, tf_none); |
1591 | if (!conv || conv->bad_p) |
1592 | return false; |
1593 | return true; |
1594 | } |
1595 | |
1596 | /* Return true if converting FROM to TO would involve a qualification |
1597 | conversion. */ |
1598 | |
1599 | static bool |
1600 | involves_qualification_conversion_p (tree to, tree from) |
1601 | { |
1602 | /* If we're not convering a pointer to another one, we won't get |
1603 | a qualification conversion. */ |
1604 | if (!((TYPE_PTR_P (to)(((enum tree_code) (to)->base.code) == POINTER_TYPE) && TYPE_PTR_P (from)(((enum tree_code) (from)->base.code) == POINTER_TYPE)) |
1605 | || (TYPE_PTRDATAMEM_P (to)(((enum tree_code) (to)->base.code) == OFFSET_TYPE) && TYPE_PTRDATAMEM_P (from)(((enum tree_code) (from)->base.code) == OFFSET_TYPE)))) |
1606 | return false; |
1607 | |
1608 | conversion *conv = standard_conversion (to, from, NULL_TREE(tree) __null, |
1609 | /*c_cast_p=*/false, 0, tf_none); |
1610 | for (conversion *t = conv; t; t = next_conversion (t)) |
1611 | if (t->kind == ck_qual) |
1612 | return true; |
1613 | |
1614 | return false; |
1615 | } |
1616 | |
1617 | /* A reference of the indicated TYPE is being bound directly to the |
1618 | expression represented by the implicit conversion sequence CONV. |
1619 | Return a conversion sequence for this binding. */ |
1620 | |
1621 | static conversion * |
1622 | direct_reference_binding (tree type, conversion *conv) |
1623 | { |
1624 | tree t; |
1625 | |
1626 | gcc_assert (TYPE_REF_P (type))((void)(!((((enum tree_code) (type)->base.code) == REFERENCE_TYPE )) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1626, __FUNCTION__), 0 : 0)); |
1627 | gcc_assert (!TYPE_REF_P (conv->type))((void)(!(!(((enum tree_code) (conv->type)->base.code) == REFERENCE_TYPE)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1627, __FUNCTION__), 0 : 0)); |
1628 | |
1629 | t = TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1629, __FUNCTION__))->typed.type); |
1630 | |
1631 | if (conv->kind == ck_identity) |
1632 | /* Mark the identity conv as to not decay to rvalue. */ |
1633 | conv->rvaluedness_matches_p = true; |
1634 | |
1635 | /* [over.ics.rank] |
1636 | |
1637 | When a parameter of reference type binds directly |
1638 | (_dcl.init.ref_) to an argument expression, the implicit |
1639 | conversion sequence is the identity conversion, unless the |
1640 | argument expression has a type that is a derived class of the |
1641 | parameter type, in which case the implicit conversion sequence is |
1642 | a derived-to-base Conversion. |
1643 | |
1644 | If the parameter binds directly to the result of applying a |
1645 | conversion function to the argument expression, the implicit |
1646 | conversion sequence is a user-defined conversion sequence |
1647 | (_over.ics.user_), with the second standard conversion sequence |
1648 | either an identity conversion or, if the conversion function |
1649 | returns an entity of a type that is a derived class of the |
1650 | parameter type, a derived-to-base conversion. */ |
1651 | if (is_properly_derived_from (conv->type, t)) |
1652 | { |
1653 | /* Represent the derived-to-base conversion. */ |
1654 | conv = build_conv (ck_base, t, conv); |
1655 | /* We will actually be binding to the base-class subobject in |
1656 | the derived class, so we mark this conversion appropriately. |
1657 | That way, convert_like knows not to generate a temporary. */ |
1658 | conv->need_temporary_p = false; |
1659 | } |
1660 | else if (involves_qualification_conversion_p (t, conv->type)) |
1661 | /* Represent the qualification conversion. After DR 2352 |
1662 | #1 and #2 were indistinguishable conversion sequences: |
1663 | |
1664 | void f(int*); // #1 |
1665 | void f(const int* const &); // #2 |
1666 | void g(int* p) { f(p); } |
1667 | |
1668 | because the types "int *" and "const int *const" are |
1669 | reference-related and we were binding both directly and they |
1670 | had the same rank. To break it up, we add a ck_qual under the |
1671 | ck_ref_bind so that conversion sequence ranking chooses #1. */ |
1672 | conv = build_conv (ck_qual, t, conv); |
1673 | |
1674 | return build_conv (ck_ref_bind, type, conv); |
1675 | } |
1676 | |
1677 | /* Returns the conversion path from type FROM to reference type TO for |
1678 | purposes of reference binding. For lvalue binding, either pass a |
1679 | reference type to FROM or an lvalue expression to EXPR. If the |
1680 | reference will be bound to a temporary, NEED_TEMPORARY_P is set for |
1681 | the conversion returned. If C_CAST_P is true, this |
1682 | conversion is coming from a C-style cast. */ |
1683 | |
1684 | static conversion * |
1685 | reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags, |
1686 | tsubst_flags_t complain) |
1687 | { |
1688 | conversion *conv = NULL__null; |
1689 | tree to = TREE_TYPE (rto)((contains_struct_check ((rto), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1689, __FUNCTION__))->typed.type); |
1690 | tree from = rfrom; |
1691 | tree tfrom; |
1692 | bool related_p; |
1693 | bool compatible_p; |
1694 | cp_lvalue_kind gl_kind; |
1695 | bool is_lvalue; |
1696 | |
1697 | if (TREE_CODE (to)((enum tree_code) (to)->base.code) == FUNCTION_TYPE && expr && type_unknown_p (expr)) |
1698 | { |
1699 | expr = instantiate_type (to, expr, tf_none); |
1700 | if (expr == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
1701 | return NULL__null; |
1702 | from = TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1702, __FUNCTION__))->typed.type); |
1703 | } |
1704 | |
1705 | bool copy_list_init = false; |
1706 | if (expr && BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR && ((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1706, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE ])) |
1707 | { |
1708 | maybe_warn_cpp0x (CPP0X_INITIALIZER_LISTS); |
1709 | /* DR 1288: Otherwise, if the initializer list has a single element |
1710 | of type E and ... [T's] referenced type is reference-related to E, |
1711 | the object or reference is initialized from that element... |
1712 | |
1713 | ??? With P0388R4, we should bind 't' directly to U{}: |
1714 | using U = A[2]; |
1715 | A (&&t)[] = {U{}}; |
1716 | because A[] and A[2] are reference-related. But we don't do it |
1717 | because grok_reference_init has deduced the array size (to 1), and |
1718 | A[1] and A[2] aren't reference-related. */ |
1719 | if (CONSTRUCTOR_NELTS (expr)(vec_safe_length (((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1719, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))) == 1) |
1720 | { |
1721 | tree elt = CONSTRUCTOR_ELT (expr, 0)(&(*((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1721, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[ 0])->value; |
1722 | if (error_operand_p (elt)((elt) == global_trees[TI_ERROR_MARK] || ((elt) && (( contains_struct_check (((elt)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1722, __FUNCTION__))->typed.type) == global_trees[TI_ERROR_MARK ]))) |
1723 | return NULL__null; |
1724 | tree etype = TREE_TYPE (elt)((contains_struct_check ((elt), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1724, __FUNCTION__))->typed.type); |
1725 | if (reference_related_p (to, etype)) |
1726 | { |
1727 | expr = elt; |
1728 | from = etype; |
1729 | goto skip; |
1730 | } |
1731 | } |
1732 | /* Otherwise, if T is a reference type, a prvalue temporary of the type |
1733 | referenced by T is copy-list-initialized, and the reference is bound |
1734 | to that temporary. */ |
1735 | copy_list_init = true; |
1736 | skip:; |
1737 | } |
1738 | |
1739 | if (TYPE_REF_P (from)(((enum tree_code) (from)->base.code) == REFERENCE_TYPE)) |
1740 | { |
1741 | from = TREE_TYPE (from)((contains_struct_check ((from), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1741, __FUNCTION__))->typed.type); |
1742 | if (!TYPE_REF_IS_RVALUE (rfrom)((tree_check ((rfrom), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1742, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag ) |
1743 | || TREE_CODE (from)((enum tree_code) (from)->base.code) == FUNCTION_TYPE) |
1744 | gl_kind = clk_ordinary; |
1745 | else |
1746 | gl_kind = clk_rvalueref; |
1747 | } |
1748 | else if (expr) |
1749 | gl_kind = lvalue_kind (expr); |
1750 | else if (CLASS_TYPE_P (from)(((((enum tree_code) (from)->base.code)) == RECORD_TYPE || (((enum tree_code) (from)->base.code)) == UNION_TYPE) && ((tree_class_check ((from), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1750, __FUNCTION__))->type_common.lang_flag_5)) |
1751 | || TREE_CODE (from)((enum tree_code) (from)->base.code) == ARRAY_TYPE) |
1752 | gl_kind = clk_class; |
1753 | else |
1754 | gl_kind = clk_none; |
1755 | |
1756 | /* Don't allow a class prvalue when LOOKUP_NO_TEMP_BIND. */ |
1757 | if ((flags & LOOKUP_NO_TEMP_BIND(1 << 6)) |
1758 | && (gl_kind & clk_class)) |
1759 | gl_kind = clk_none; |
1760 | |
1761 | /* Same mask as real_lvalue_p. */ |
1762 | is_lvalue = gl_kind && !(gl_kind & (clk_rvalueref|clk_class)); |
1763 | |
1764 | tfrom = from; |
1765 | if ((gl_kind & clk_bitfield) != 0) |
1766 | tfrom = unlowered_expr_type (expr); |
1767 | |
1768 | /* Figure out whether or not the types are reference-related and |
1769 | reference compatible. We have to do this after stripping |
1770 | references from FROM. */ |
1771 | related_p = reference_related_p (to, tfrom); |
1772 | /* If this is a C cast, first convert to an appropriately qualified |
1773 | type, so that we can later do a const_cast to the desired type. */ |
1774 | if (related_p && c_cast_p |
1775 | && !at_least_as_qualified_p (to, tfrom)) |
1776 | to = cp_build_qualified_type (to, cp_type_quals (tfrom))cp_build_qualified_type_real ((to), (cp_type_quals (tfrom)), tf_warning_or_error ); |
1777 | compatible_p = reference_compatible_p (to, tfrom); |
1778 | |
1779 | /* Directly bind reference when target expression's type is compatible with |
1780 | the reference and expression is an lvalue. In DR391, the wording in |
1781 | [8.5.3/5 dcl.init.ref] is changed to also require direct bindings for |
1782 | const and rvalue references to rvalues of compatible class type. |
1783 | We should also do direct bindings for non-class xvalues. */ |
1784 | if ((related_p || compatible_p) && gl_kind) |
1785 | { |
1786 | /* [dcl.init.ref] |
1787 | |
1788 | If the initializer expression |
1789 | |
1790 | -- is an lvalue (but not an lvalue for a bit-field), and "cv1 T1" |
1791 | is reference-compatible with "cv2 T2," |
1792 | |
1793 | the reference is bound directly to the initializer expression |
1794 | lvalue. |
1795 | |
1796 | [...] |
1797 | If the initializer expression is an rvalue, with T2 a class type, |
1798 | and "cv1 T1" is reference-compatible with "cv2 T2", the reference |
1799 | is bound to the object represented by the rvalue or to a sub-object |
1800 | within that object. */ |
1801 | |
1802 | conv = build_identity_conv (tfrom, expr); |
1803 | conv = direct_reference_binding (rto, conv); |
1804 | |
1805 | if (TYPE_REF_P (rfrom)(((enum tree_code) (rfrom)->base.code) == REFERENCE_TYPE)) |
1806 | /* Handle rvalue reference to function properly. */ |
1807 | conv->rvaluedness_matches_p |
1808 | = (TYPE_REF_IS_RVALUE (rto)((tree_check ((rto), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1808, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag ) == TYPE_REF_IS_RVALUE (rfrom)((tree_check ((rfrom), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1808, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag )); |
1809 | else |
1810 | conv->rvaluedness_matches_p |
1811 | = (TYPE_REF_IS_RVALUE (rto)((tree_check ((rto), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1811, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag ) == !is_lvalue); |
1812 | |
1813 | if ((gl_kind & clk_bitfield) != 0 |
1814 | || ((gl_kind & clk_packed) != 0 && !TYPE_PACKED (to)((tree_class_check ((to), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1814, __FUNCTION__))->base.u.bits.packed_flag))) |
1815 | /* For the purposes of overload resolution, we ignore the fact |
1816 | this expression is a bitfield or packed field. (In particular, |
1817 | [over.ics.ref] says specifically that a function with a |
1818 | non-const reference parameter is viable even if the |
1819 | argument is a bitfield.) |
1820 | |
1821 | However, when we actually call the function we must create |
1822 | a temporary to which to bind the reference. If the |
1823 | reference is volatile, or isn't const, then we cannot make |
1824 | a temporary, so we just issue an error when the conversion |
1825 | actually occurs. */ |
1826 | conv->need_temporary_p = true; |
1827 | |
1828 | /* Don't allow binding of lvalues (other than function lvalues) to |
1829 | rvalue references. */ |
1830 | if (is_lvalue && TYPE_REF_IS_RVALUE (rto)((tree_check ((rto), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1830, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag ) |
1831 | && TREE_CODE (to)((enum tree_code) (to)->base.code) != FUNCTION_TYPE) |
1832 | conv->bad_p = true; |
1833 | |
1834 | /* Nor the reverse. */ |
1835 | if (!is_lvalue && !TYPE_REF_IS_RVALUE (rto)((tree_check ((rto), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1835, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag ) |
1836 | /* Unless it's really an lvalue. */ |
1837 | && !(cxx_dialect >= cxx20 |
1838 | && (gl_kind & clk_implicit_rval)) |
1839 | && (!CP_TYPE_CONST_NON_VOLATILE_P (to)((cp_type_quals (to) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE )) == TYPE_QUAL_CONST) |
1840 | || (flags & LOOKUP_NO_RVAL_BIND((((((((((1 << 6) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1 ))) |
1841 | && TREE_CODE (to)((enum tree_code) (to)->base.code) != FUNCTION_TYPE) |
1842 | conv->bad_p = true; |
1843 | |
1844 | if (!compatible_p) |
1845 | conv->bad_p = true; |
1846 | |
1847 | return conv; |
1848 | } |
1849 | /* [class.conv.fct] A conversion function is never used to convert a |
1850 | (possibly cv-qualified) object to the (possibly cv-qualified) same |
1851 | object type (or a reference to it), to a (possibly cv-qualified) base |
1852 | class of that type (or a reference to it).... */ |
1853 | else if (CLASS_TYPE_P (from)(((((enum tree_code) (from)->base.code)) == RECORD_TYPE || (((enum tree_code) (from)->base.code)) == UNION_TYPE) && ((tree_class_check ((from), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1853, __FUNCTION__))->type_common.lang_flag_5)) && !related_p |
1854 | && !(flags & LOOKUP_NO_CONVERSION(1 << 4))) |
1855 | { |
1856 | /* [dcl.init.ref] |
1857 | |
1858 | If the initializer expression |
1859 | |
1860 | -- has a class type (i.e., T2 is a class type) can be |
1861 | implicitly converted to an lvalue of type "cv3 T3," where |
1862 | "cv1 T1" is reference-compatible with "cv3 T3". (this |
1863 | conversion is selected by enumerating the applicable |
1864 | conversion functions (_over.match.ref_) and choosing the |
1865 | best one through overload resolution. (_over.match_). |
1866 | |
1867 | the reference is bound to the lvalue result of the conversion |
1868 | in the second case. */ |
1869 | z_candidate *cand = build_user_type_conversion_1 (rto, expr, flags, |
1870 | complain); |
1871 | if (cand) |
1872 | return cand->second_conv; |
1873 | } |
1874 | |
1875 | /* From this point on, we conceptually need temporaries, even if we |
1876 | elide them. Only the cases above are "direct bindings". */ |
1877 | if (flags & LOOKUP_NO_TEMP_BIND(1 << 6)) |
1878 | return NULL__null; |
1879 | |
1880 | /* [over.ics.rank] |
1881 | |
1882 | When a parameter of reference type is not bound directly to an |
1883 | argument expression, the conversion sequence is the one required |
1884 | to convert the argument expression to the underlying type of the |
1885 | reference according to _over.best.ics_. Conceptually, this |
1886 | conversion sequence corresponds to copy-initializing a temporary |
1887 | of the underlying type with the argument expression. Any |
1888 | difference in top-level cv-qualification is subsumed by the |
1889 | initialization itself and does not constitute a conversion. */ |
1890 | |
1891 | /* [dcl.init.ref] |
1892 | |
1893 | Otherwise, the reference shall be an lvalue reference to a |
1894 | non-volatile const type, or the reference shall be an rvalue |
1895 | reference. |
1896 | |
1897 | We try below to treat this as a bad conversion to improve diagnostics, |
1898 | but if TO is an incomplete class, we need to reject this conversion |
1899 | now to avoid unnecessary instantiation. */ |
1900 | if (!CP_TYPE_CONST_NON_VOLATILE_P (to)((cp_type_quals (to) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE )) == TYPE_QUAL_CONST) && !TYPE_REF_IS_RVALUE (rto)((tree_check ((rto), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1900, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag ) |
1901 | && !COMPLETE_TYPE_P (to)(((tree_class_check ((to), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1901, __FUNCTION__))->type_common.size) != (tree) __null )) |
1902 | return NULL__null; |
1903 | |
1904 | /* We're generating a temporary now, but don't bind any more in the |
1905 | conversion (specifically, don't slice the temporary returned by a |
1906 | conversion operator). */ |
1907 | flags |= LOOKUP_NO_TEMP_BIND(1 << 6); |
1908 | |
1909 | /* Core issue 899: When [copy-]initializing a temporary to be bound |
1910 | to the first parameter of a copy constructor (12.8) called with |
1911 | a single argument in the context of direct-initialization, |
1912 | explicit conversion functions are also considered. |
1913 | |
1914 | So don't set LOOKUP_ONLYCONVERTING in that case. */ |
1915 | if (!(flags & LOOKUP_COPY_PARM(((((1 << 6) << 1) << 1) << 1) << 1))) |
1916 | flags |= LOOKUP_ONLYCONVERTING(1 << 2); |
1917 | |
1918 | if (!conv) |
1919 | conv = implicit_conversion (to, from, expr, c_cast_p, |
1920 | flags, complain); |
1921 | if (!conv) |
1922 | return NULL__null; |
1923 | |
1924 | if (conv->user_conv_p) |
1925 | { |
1926 | if (copy_list_init) |
1927 | /* Remember this was copy-list-initialization. */ |
1928 | conv->need_temporary_p = true; |
1929 | |
1930 | /* If initializing the temporary used a conversion function, |
1931 | recalculate the second conversion sequence. */ |
1932 | for (conversion *t = conv; t; t = next_conversion (t)) |
1933 | if (t->kind == ck_user |
1934 | && DECL_CONV_FN_P (t->cand->fn)((((tree_not_check2 (((tree_check ((((contains_struct_check ( (t->cand->fn), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1934, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1934, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1934, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_2)) & ((tree_not_check2 (((tree_check ((((contains_struct_check ((t->cand->fn), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1934, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1934, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1934, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_1) & (!((tree_not_check2 (((tree_check ((((contains_struct_check ((t->cand->fn), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1934, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1934, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1934, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_0)))) |
1935 | { |
1936 | tree ftype = TREE_TYPE (TREE_TYPE (t->cand->fn))((contains_struct_check ((((contains_struct_check ((t->cand ->fn), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1936, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1936, __FUNCTION__))->typed.type); |
1937 | /* A prvalue of non-class type is cv-unqualified. */ |
1938 | if (!TYPE_REF_P (ftype)(((enum tree_code) (ftype)->base.code) == REFERENCE_TYPE) && !CLASS_TYPE_P (ftype)(((((enum tree_code) (ftype)->base.code)) == RECORD_TYPE || (((enum tree_code) (ftype)->base.code)) == UNION_TYPE) && ((tree_class_check ((ftype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1938, __FUNCTION__))->type_common.lang_flag_5))) |
1939 | ftype = cv_unqualified (ftype); |
1940 | int sflags = (flags|LOOKUP_NO_CONVERSION(1 << 4))&~LOOKUP_NO_TEMP_BIND(1 << 6); |
1941 | conversion *new_second |
1942 | = reference_binding (rto, ftype, NULL_TREE(tree) __null, c_cast_p, |
1943 | sflags, complain); |
1944 | if (!new_second) |
1945 | return NULL__null; |
1946 | return merge_conversion_sequences (t, new_second); |
1947 | } |
1948 | } |
1949 | |
1950 | conv = build_conv (ck_ref_bind, rto, conv); |
1951 | /* This reference binding, unlike those above, requires the |
1952 | creation of a temporary. */ |
1953 | conv->need_temporary_p = true; |
1954 | conv->rvaluedness_matches_p = TYPE_REF_IS_RVALUE (rto)((tree_check ((rto), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1954, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag ); |
1955 | |
1956 | /* [dcl.init.ref] |
1957 | |
1958 | Otherwise, the reference shall be an lvalue reference to a |
1959 | non-volatile const type, or the reference shall be an rvalue |
1960 | reference. */ |
1961 | if (!CP_TYPE_CONST_NON_VOLATILE_P (to)((cp_type_quals (to) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE )) == TYPE_QUAL_CONST) && !TYPE_REF_IS_RVALUE (rto)((tree_check ((rto), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 1961, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag )) |
1962 | conv->bad_p = true; |
1963 | |
1964 | /* [dcl.init.ref] |
1965 | |
1966 | Otherwise, a temporary of type "cv1 T1" is created and |
1967 | initialized from the initializer expression using the rules for a |
1968 | non-reference copy initialization. If T1 is reference-related to |
1969 | T2, cv1 must be the same cv-qualification as, or greater |
1970 | cv-qualification than, cv2; otherwise, the program is ill-formed. */ |
1971 | if (related_p && !at_least_as_qualified_p (to, from)) |
1972 | conv->bad_p = true; |
1973 | |
1974 | return conv; |
1975 | } |
1976 | |
1977 | /* Most of the implementation of implicit_conversion, with the same |
1978 | parameters. */ |
1979 | |
1980 | static conversion * |
1981 | implicit_conversion_1 (tree to, tree from, tree expr, bool c_cast_p, |
1982 | int flags, tsubst_flags_t complain) |
1983 | { |
1984 | conversion *conv; |
1985 | |
1986 | if (from == error_mark_nodeglobal_trees[TI_ERROR_MARK] || to == error_mark_nodeglobal_trees[TI_ERROR_MARK] |
1987 | || expr == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
1988 | return NULL__null; |
1989 | |
1990 | /* Other flags only apply to the primary function in overload |
1991 | resolution, or after we've chosen one. */ |
1992 | flags &= (LOOKUP_ONLYCONVERTING(1 << 2)|LOOKUP_NO_CONVERSION(1 << 4)|LOOKUP_COPY_PARM(((((1 << 6) << 1) << 1) << 1) << 1) |
1993 | |LOOKUP_NO_TEMP_BIND(1 << 6)|LOOKUP_NO_RVAL_BIND((((((((((1 << 6) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1 )|LOOKUP_PREFER_RVALUE((1 << 6) << 1) |
1994 | |LOOKUP_NO_NARROWING(((1 << 6) << 1) << 1)|LOOKUP_PROTECT(1 << 0)|LOOKUP_NO_NON_INTEGRAL(((((((((((1 << 6) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1 ) << 1)); |
1995 | |
1996 | /* FIXME: actually we don't want warnings either, but we can't just |
1997 | have 'complain &= ~(tf_warning|tf_error)' because it would cause |
1998 | the regression of, eg, g++.old-deja/g++.benjamin/16077.C. |
1999 | We really ought not to issue that warning until we've committed |
2000 | to that conversion. */ |
2001 | complain &= ~tf_error; |
2002 | |
2003 | /* Call reshape_init early to remove redundant braces. */ |
2004 | if (expr && BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR && ((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2004, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE ]) |
2005 | && CLASS_TYPE_P (to)(((((enum tree_code) (to)->base.code)) == RECORD_TYPE || ( ((enum tree_code) (to)->base.code)) == UNION_TYPE) && ((tree_class_check ((to), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2005, __FUNCTION__))->type_common.lang_flag_5)) |
2006 | && COMPLETE_TYPE_P (complete_type (to))(((tree_class_check ((complete_type (to)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2006, __FUNCTION__))->type_common.size) != (tree) __null ) |
2007 | && !CLASSTYPE_NON_AGGREGATE (to)((((tree_class_check ((to), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2007, __FUNCTION__))->type_with_lang_specific.lang_specific ))->non_aggregate)) |
2008 | { |
2009 | expr = reshape_init (to, expr, complain); |
2010 | if (expr == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
2011 | return NULL__null; |
2012 | from = TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2012, __FUNCTION__))->typed.type); |
2013 | } |
2014 | |
2015 | if (TYPE_REF_P (to)(((enum tree_code) (to)->base.code) == REFERENCE_TYPE)) |
2016 | conv = reference_binding (to, from, expr, c_cast_p, flags, complain); |
2017 | else |
2018 | conv = standard_conversion (to, from, expr, c_cast_p, flags, complain); |
2019 | |
2020 | if (conv) |
2021 | return conv; |
2022 | |
2023 | if (expr && BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR && ((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2023, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE ])) |
2024 | { |
2025 | if (is_std_init_list (to) && !CONSTRUCTOR_IS_DESIGNATED_INIT (expr)(((tree_not_check2 (((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2025, __FUNCTION__, (CONSTRUCTOR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2025, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_6))) |
2026 | return build_list_conv (to, expr, flags, complain); |
2027 | |
2028 | /* As an extension, allow list-initialization of _Complex. */ |
2029 | if (TREE_CODE (to)((enum tree_code) (to)->base.code) == COMPLEX_TYPE |
2030 | && !CONSTRUCTOR_IS_DESIGNATED_INIT (expr)(((tree_not_check2 (((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2030, __FUNCTION__, (CONSTRUCTOR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2030, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_6))) |
2031 | { |
2032 | conv = build_complex_conv (to, expr, flags, complain); |
2033 | if (conv) |
2034 | return conv; |
2035 | } |
2036 | |
2037 | /* Allow conversion from an initializer-list with one element to a |
2038 | scalar type. */ |
2039 | if (SCALAR_TYPE_P (to)((((enum tree_code) (to)->base.code) == OFFSET_TYPE) || (( enum tree_code) (to)->base.code) == ENUMERAL_TYPE || ((((enum tree_code) (to)->base.code) == BOOLEAN_TYPE || ((enum tree_code ) (to)->base.code) == INTEGER_TYPE) || ((enum tree_code) ( to)->base.code) == REAL_TYPE || ((enum tree_code) (to)-> base.code) == COMPLEX_TYPE) || (((enum tree_code) (to)->base .code) == POINTER_TYPE) || (((enum tree_code) (to)->base.code ) == RECORD_TYPE && (((tree_class_check (((tree_check ((to), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2039, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2039, __FUNCTION__))->type_common.lang_flag_2))) || (((enum tree_code) (to)->base.code) == NULLPTR_TYPE))) |
2040 | { |
2041 | int nelts = CONSTRUCTOR_NELTS (expr)(vec_safe_length (((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2041, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))); |
2042 | tree elt; |
2043 | |
2044 | if (nelts == 0) |
2045 | elt = build_value_init (to, tf_none); |
2046 | else if (nelts == 1 && !CONSTRUCTOR_IS_DESIGNATED_INIT (expr)(((tree_not_check2 (((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2046, __FUNCTION__, (CONSTRUCTOR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2046, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_6))) |
2047 | elt = CONSTRUCTOR_ELT (expr, 0)(&(*((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2047, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[ 0])->value; |
2048 | else |
2049 | elt = error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
2050 | |
2051 | conv = implicit_conversion (to, TREE_TYPE (elt)((contains_struct_check ((elt), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2051, __FUNCTION__))->typed.type), elt, |
2052 | c_cast_p, flags, complain); |
2053 | if (conv) |
2054 | { |
2055 | conv->check_narrowing = true; |
2056 | if (BRACE_ENCLOSED_INITIALIZER_P (elt)(((enum tree_code) (elt)->base.code) == CONSTRUCTOR && ((contains_struct_check ((elt), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2056, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE ])) |
2057 | /* Too many levels of braces, i.e. '{{1}}'. */ |
2058 | conv->bad_p = true; |
2059 | return conv; |
2060 | } |
2061 | } |
2062 | else if (TREE_CODE (to)((enum tree_code) (to)->base.code) == ARRAY_TYPE) |
2063 | return build_array_conv (to, expr, flags, complain); |
2064 | } |
2065 | |
2066 | if (expr != NULL_TREE(tree) __null |
2067 | && (MAYBE_CLASS_TYPE_P (from)((((enum tree_code) (from)->base.code) == TEMPLATE_TYPE_PARM || ((enum tree_code) (from)->base.code) == TYPENAME_TYPE || ((enum tree_code) (from)->base.code) == TYPEOF_TYPE || (( enum tree_code) (from)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM || ((enum tree_code) (from)->base.code) == DECLTYPE_TYPE) || (((((enum tree_code) (from)->base.code)) == RECORD_TYPE || (((enum tree_code) (from)->base.code)) == UNION_TYPE) && ((tree_class_check ((from), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2067, __FUNCTION__))->type_common.lang_flag_5))) |
2068 | || MAYBE_CLASS_TYPE_P (to)((((enum tree_code) (to)->base.code) == TEMPLATE_TYPE_PARM || ((enum tree_code) (to)->base.code) == TYPENAME_TYPE || ((enum tree_code) (to)->base.code) == TYPEOF_TYPE || ((enum tree_code) (to)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM || ((enum tree_code) (to)->base.code) == DECLTYPE_TYPE) || (((((enum tree_code) (to)->base.code)) == RECORD_TYPE || ( ((enum tree_code) (to)->base.code)) == UNION_TYPE) && ((tree_class_check ((to), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2068, __FUNCTION__))->type_common.lang_flag_5)))) |
2069 | && (flags & LOOKUP_NO_CONVERSION(1 << 4)) == 0) |
2070 | { |
2071 | struct z_candidate *cand; |
2072 | |
2073 | if (CLASS_TYPE_P (to)(((((enum tree_code) (to)->base.code)) == RECORD_TYPE || ( ((enum tree_code) (to)->base.code)) == UNION_TYPE) && ((tree_class_check ((to), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2073, __FUNCTION__))->type_common.lang_flag_5)) |
2074 | && BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR && ((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2074, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE ]) |
2075 | && !CLASSTYPE_NON_AGGREGATE (complete_type (to))((((tree_class_check ((complete_type (to)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2075, __FUNCTION__))->type_with_lang_specific.lang_specific ))->non_aggregate)) |
2076 | return build_aggr_conv (to, expr, flags, complain); |
2077 | |
2078 | cand = build_user_type_conversion_1 (to, expr, flags, complain); |
2079 | if (cand) |
2080 | { |
2081 | if (BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR && ((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2081, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE ]) |
2082 | && CONSTRUCTOR_NELTS (expr)(vec_safe_length (((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2082, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))) == 1 |
2083 | && !is_list_ctor (cand->fn)) |
2084 | { |
2085 | /* "If C is not an initializer-list constructor and the |
2086 | initializer list has a single element of type cv U, where U is |
2087 | X or a class derived from X, the implicit conversion sequence |
2088 | has Exact Match rank if U is X, or Conversion rank if U is |
2089 | derived from X." */ |
2090 | tree elt = CONSTRUCTOR_ELT (expr, 0)(&(*((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2090, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[ 0])->value; |
2091 | tree elttype = TREE_TYPE (elt)((contains_struct_check ((elt), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2091, __FUNCTION__))->typed.type); |
2092 | if (reference_related_p (to, elttype)) |
2093 | return implicit_conversion (to, elttype, elt, |
2094 | c_cast_p, flags, complain); |
2095 | } |
2096 | conv = cand->second_conv; |
2097 | } |
2098 | |
2099 | /* We used to try to bind a reference to a temporary here, but that |
2100 | is now handled after the recursive call to this function at the end |
2101 | of reference_binding. */ |
2102 | return conv; |
2103 | } |
2104 | |
2105 | return NULL__null; |
2106 | } |
2107 | |
2108 | /* Returns the implicit conversion sequence (see [over.ics]) from type |
2109 | FROM to type TO. The optional expression EXPR may affect the |
2110 | conversion. FLAGS are the usual overloading flags. If C_CAST_P is |
2111 | true, this conversion is coming from a C-style cast. */ |
2112 | |
2113 | static conversion * |
2114 | implicit_conversion (tree to, tree from, tree expr, bool c_cast_p, |
2115 | int flags, tsubst_flags_t complain) |
2116 | { |
2117 | conversion *conv = implicit_conversion_1 (to, from, expr, c_cast_p, |
2118 | flags, complain); |
2119 | if (!conv || conv->bad_p) |
2120 | return conv; |
2121 | if (conv_is_prvalue (conv) |
2122 | && CLASS_TYPE_P (conv->type)(((((enum tree_code) (conv->type)->base.code)) == RECORD_TYPE || (((enum tree_code) (conv->type)->base.code)) == UNION_TYPE ) && ((tree_class_check ((conv->type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2122, __FUNCTION__))->type_common.lang_flag_5)) |
2123 | && CLASSTYPE_PURE_VIRTUALS (conv->type)((((tree_class_check ((conv->type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2123, __FUNCTION__))->type_with_lang_specific.lang_specific ))->pure_virtuals)) |
2124 | conv->bad_p = true; |
2125 | return conv; |
2126 | } |
2127 | |
2128 | /* Like implicit_conversion, but return NULL if the conversion is bad. |
2129 | |
2130 | This is not static so that check_non_deducible_conversion can call it within |
2131 | add_template_candidate_real as part of overload resolution; it should not be |
2132 | called outside of overload resolution. */ |
2133 | |
2134 | conversion * |
2135 | good_conversion (tree to, tree from, tree expr, |
2136 | int flags, tsubst_flags_t complain) |
2137 | { |
2138 | conversion *c = implicit_conversion (to, from, expr, /*cast*/false, |
2139 | flags, complain); |
2140 | if (c && c->bad_p) |
2141 | c = NULL__null; |
2142 | return c; |
2143 | } |
2144 | |
2145 | /* Add a new entry to the list of candidates. Used by the add_*_candidate |
2146 | functions. ARGS will not be changed until a single candidate is |
2147 | selected. */ |
2148 | |
2149 | static struct z_candidate * |
2150 | add_candidate (struct z_candidate **candidates, |
2151 | tree fn, tree first_arg, const vec<tree, va_gc> *args, |
2152 | size_t num_convs, conversion **convs, |
2153 | tree access_path, tree conversion_path, |
2154 | int viable, struct rejection_reason *reason, |
2155 | int flags) |
2156 | { |
2157 | struct z_candidate *cand = (struct z_candidate *) |
2158 | conversion_obstack_alloc (sizeof (struct z_candidate)); |
2159 | |
2160 | cand->fn = fn; |
2161 | cand->first_arg = first_arg; |
2162 | cand->args = args; |
2163 | cand->convs = convs; |
2164 | cand->num_convs = num_convs; |
2165 | cand->access_path = access_path; |
2166 | cand->conversion_path = conversion_path; |
2167 | cand->viable = viable; |
2168 | cand->reason = reason; |
2169 | cand->next = *candidates; |
2170 | cand->flags = flags; |
2171 | *candidates = cand; |
2172 | |
2173 | if (convs && cand->reversed ()) |
2174 | /* Swap the conversions for comparison in joust; we'll swap them back |
2175 | before build_over_call. */ |
2176 | std::swap (convs[0], convs[1]); |
2177 | |
2178 | return cand; |
2179 | } |
2180 | |
2181 | /* Return the number of remaining arguments in the parameter list |
2182 | beginning with ARG. */ |
2183 | |
2184 | int |
2185 | remaining_arguments (tree arg) |
2186 | { |
2187 | int n; |
2188 | |
2189 | for (n = 0; arg != NULL_TREE(tree) __null && arg != void_list_nodeglobal_trees[TI_VOID_LIST_NODE]; |
2190 | arg = TREE_CHAIN (arg)((contains_struct_check ((arg), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2190, __FUNCTION__))->common.chain)) |
2191 | n++; |
2192 | |
2193 | return n; |
2194 | } |
2195 | |
2196 | /* [over.match.copy]: When initializing a temporary object (12.2) to be bound |
2197 | to the first parameter of a constructor where the parameter is of type |
2198 | "reference to possibly cv-qualified T" and the constructor is called with a |
2199 | single argument in the context of direct-initialization of an object of type |
2200 | "cv2 T", explicit conversion functions are also considered. |
2201 | |
2202 | So set LOOKUP_COPY_PARM to let reference_binding know that |
2203 | it's being called in that context. */ |
2204 | |
2205 | int |
2206 | conv_flags (int i, int nargs, tree fn, tree arg, int flags) |
2207 | { |
2208 | int lflags = flags; |
2209 | tree t; |
2210 | if (i == 0 && nargs == 1 && DECL_CONSTRUCTOR_P (fn)((tree_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2210, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn) ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2210, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor ) |
2211 | && (t = FUNCTION_FIRST_USER_PARMTYPE (fn)skip_artificial_parms_for ((fn), ((tree_check2 ((((contains_struct_check ((fn), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2211, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2211, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values))) |
2212 | && (same_type_ignoring_top_level_qualifiers_p |
2213 | (non_reference (TREE_VALUE (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2213, __FUNCTION__, (TREE_LIST)))->list.value)), DECL_CONTEXT (fn)((contains_struct_check ((fn), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2213, __FUNCTION__))->decl_minimal.context)))) |
2214 | { |
2215 | if (!(flags & LOOKUP_ONLYCONVERTING(1 << 2))) |
2216 | lflags |= LOOKUP_COPY_PARM(((((1 << 6) << 1) << 1) << 1) << 1); |
2217 | if ((flags & LOOKUP_LIST_INIT_CTOR((((1 << 6) << 1) << 1) << 1)) |
2218 | && BRACE_ENCLOSED_INITIALIZER_P (arg)(((enum tree_code) (arg)->base.code) == CONSTRUCTOR && ((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2218, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE ])) |
2219 | lflags |= LOOKUP_NO_CONVERSION(1 << 4); |
2220 | } |
2221 | else |
2222 | lflags |= LOOKUP_ONLYCONVERTING(1 << 2); |
2223 | |
2224 | return lflags; |
2225 | } |
2226 | |
2227 | /* Create an overload candidate for the function or method FN called |
2228 | with the argument list FIRST_ARG/ARGS and add it to CANDIDATES. |
2229 | FLAGS is passed on to implicit_conversion. |
2230 | |
2231 | This does not change ARGS. |
2232 | |
2233 | CTYPE, if non-NULL, is the type we want to pretend this function |
2234 | comes from for purposes of overload resolution. */ |
2235 | |
2236 | static struct z_candidate * |
2237 | add_function_candidate (struct z_candidate **candidates, |
2238 | tree fn, tree ctype, tree first_arg, |
2239 | const vec<tree, va_gc> *args, tree access_path, |
2240 | tree conversion_path, int flags, |
2241 | conversion **convs, |
2242 | tsubst_flags_t complain) |
2243 | { |
2244 | tree parmlist = TYPE_ARG_TYPES (TREE_TYPE (fn))((tree_check2 ((((contains_struct_check ((fn), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2244, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2244, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values); |
2245 | int i, len; |
2246 | tree parmnode; |
2247 | tree orig_first_arg = first_arg; |
2248 | int skip; |
2249 | int viable = 1; |
2250 | struct rejection_reason *reason = NULL__null; |
2251 | |
2252 | /* The `this', `in_chrg' and VTT arguments to constructors are not |
2253 | considered in overload resolution. */ |
2254 | if (DECL_CONSTRUCTOR_P (fn)((tree_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2254, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn) ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2254, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor )) |
2255 | { |
2256 | if (ctor_omit_inherited_parms (fn)) |
2257 | /* Bring back parameters omitted from an inherited ctor. */ |
2258 | parmlist = FUNCTION_FIRST_USER_PARMTYPE (DECL_ORIGIN (fn))skip_artificial_parms_for (((((contains_struct_check ((fn), ( TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2258, __FUNCTION__))->decl_common.abstract_origin) ? ((contains_struct_check ((fn), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2258, __FUNCTION__))->decl_common.abstract_origin) : (fn ))), ((tree_check2 ((((contains_struct_check (((((contains_struct_check ((fn), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2258, __FUNCTION__))->decl_common.abstract_origin) ? ((contains_struct_check ((fn), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2258, __FUNCTION__))->decl_common.abstract_origin) : (fn ))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2258, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2258, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values)); |
2259 | else |
2260 | parmlist = skip_artificial_parms_for (fn, parmlist); |
2261 | skip = num_artificial_parms_for (fn); |
2262 | if (skip > 0 && first_arg != NULL_TREE(tree) __null) |
2263 | { |
2264 | --skip; |
2265 | first_arg = NULL_TREE(tree) __null; |
2266 | } |
2267 | } |
2268 | else |
2269 | skip = 0; |
2270 | |
2271 | len = vec_safe_length (args) - skip + (first_arg != NULL_TREE(tree) __null ? 1 : 0); |
2272 | if (!convs) |
2273 | convs = alloc_conversions (len); |
2274 | |
2275 | /* 13.3.2 - Viable functions [over.match.viable] |
2276 | First, to be a viable function, a candidate function shall have enough |
2277 | parameters to agree in number with the arguments in the list. |
2278 | |
2279 | We need to check this first; otherwise, checking the ICSes might cause |
2280 | us to produce an ill-formed template instantiation. */ |
2281 | |
2282 | parmnode = parmlist; |
2283 | for (i = 0; i < len; ++i) |
2284 | { |
2285 | if (parmnode == NULL_TREE(tree) __null || parmnode == void_list_nodeglobal_trees[TI_VOID_LIST_NODE]) |
2286 | break; |
2287 | parmnode = TREE_CHAIN (parmnode)((contains_struct_check ((parmnode), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2287, __FUNCTION__))->common.chain); |
2288 | } |
2289 | |
2290 | if ((i < len && parmnode) |
2291 | || !sufficient_parms_p (parmnode)) |
2292 | { |
2293 | int remaining = remaining_arguments (parmnode); |
2294 | viable = 0; |
2295 | reason = arity_rejection (first_arg, i + remaining, len); |
2296 | } |
2297 | |
2298 | /* An inherited constructor (12.6.3 [class.inhctor.init]) that has a first |
2299 | parameter of type "reference to cv C" (including such a constructor |
2300 | instantiated from a template) is excluded from the set of candidate |
2301 | functions when used to construct an object of type D with an argument list |
2302 | containing a single argument if C is reference-related to D. */ |
2303 | if (viable && len == 1 && parmlist && DECL_CONSTRUCTOR_P (fn)((tree_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2303, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn) ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2303, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor ) |
2304 | && flag_new_inheriting_ctorsglobal_options.x_flag_new_inheriting_ctors |
2305 | && DECL_INHERITED_CTOR (fn)((((enum tree_code) (fn)->base.code) == FUNCTION_DECL || ( ((enum tree_code) (fn)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2305, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2305, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) && ((tree_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2305, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn) ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2305, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor ) ? __extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? ( (struct tree_template_decl *)(const_cast<union tree_node * > ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2305, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn) ), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2305, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) (fn)->base.code) == FUNCTION_DECL || ((( enum tree_code) (fn)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2305, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2305, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2305, __FUNCTION__); <->u.fn; })->context : (tree ) __null)) |
2306 | { |
2307 | tree ptype = non_reference (TREE_VALUE (parmlist)((tree_check ((parmlist), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2307, __FUNCTION__, (TREE_LIST)))->list.value)); |
2308 | tree dtype = DECL_CONTEXT (fn)((contains_struct_check ((fn), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2308, __FUNCTION__))->decl_minimal.context); |
2309 | tree btype = DECL_INHERITED_CTOR_BASE (fn)(((((enum tree_code) (fn)->base.code) == FUNCTION_DECL || ( ((enum tree_code) (fn)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2309, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2309, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) && ((tree_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2309, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn) ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2309, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor ) ? __extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? ( (struct tree_template_decl *)(const_cast<union tree_node * > ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2309, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn) ), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2309, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) (fn)->base.code) == FUNCTION_DECL || ((( enum tree_code) (fn)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2309, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2309, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2309, __FUNCTION__); <->u.fn; })->context : (tree ) __null) ? ((contains_struct_check ((global_options.x_flag_new_inheriting_ctors ? strip_inheriting_ctors (fn) : ((((enum tree_code) (fn)-> base.code) == FUNCTION_DECL || (((enum tree_code) (fn)->base .code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2309, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2309, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) && ((tree_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2309, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn) ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2309, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor ) ? __extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? ( (struct tree_template_decl *)(const_cast<union tree_node * > ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2309, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn) ), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2309, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) (fn)->base.code) == FUNCTION_DECL || ((( enum tree_code) (fn)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2309, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2309, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2309, __FUNCTION__); <->u.fn; })->context : (tree ) __null)), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2309, __FUNCTION__))->decl_minimal.context) : (tree) __null ); |
2310 | if (reference_related_p (ptype, dtype) |
2311 | && reference_related_p (btype, ptype)) |
2312 | { |
2313 | viable = false; |
2314 | reason = inherited_ctor_rejection (); |
2315 | } |
2316 | } |
2317 | |
2318 | /* Second, for a function to be viable, its constraints must be |
2319 | satisfied. */ |
2320 | if (flag_conceptsglobal_options.x_flag_concepts && viable && !constraints_satisfied_p (fn)) |
2321 | { |
2322 | reason = constraint_failure (); |
2323 | viable = false; |
2324 | } |
2325 | |
2326 | /* When looking for a function from a subobject from an implicit |
2327 | copy/move constructor/operator=, don't consider anything that takes (a |
2328 | reference to) an unrelated type. See c++/44909 and core 1092. */ |
2329 | if (viable && parmlist && (flags & LOOKUP_DEFAULTED((((((((1 << 6) << 1) << 1) << 1) << 1) << 1) << 1) << 1))) |
2330 | { |
2331 | if (DECL_CONSTRUCTOR_P (fn)((tree_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2331, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn) ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2331, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor )) |
2332 | i = 1; |
2333 | else if (DECL_ASSIGNMENT_OPERATOR_P (fn)(((((tree_not_check2 (((tree_check ((((contains_struct_check ( (fn), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2333, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2333, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2333, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_2)) & (!((tree_not_check2 (((tree_check ((((contains_struct_check ((fn), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2333, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2333, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2333, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_1))) & ((tree_not_check2 (((tree_check ((((contains_struct_check ((fn), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2333, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2333, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2333, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_0)) |
2334 | && DECL_OVERLOADED_OPERATOR_IS (fn, NOP_EXPR)((__extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? ( (struct tree_template_decl *)(const_cast<union tree_node * > ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2334, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn) ), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2334, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) (fn)->base.code) == FUNCTION_DECL || ((( enum tree_code) (fn)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2334, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2334, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2334, __FUNCTION__); <->u.fn; })->ovl_op_code) == OVL_OP_NOP_EXPR)) |
2335 | i = 2; |
2336 | else |
2337 | i = 0; |
2338 | if (i && len == i) |
2339 | { |
2340 | parmnode = chain_index (i-1, parmlist); |
2341 | if (!reference_related_p (non_reference (TREE_VALUE (parmnode)((tree_check ((parmnode), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2341, __FUNCTION__, (TREE_LIST)))->list.value)), |
2342 | ctype)) |
2343 | viable = 0; |
2344 | } |
2345 | |
2346 | /* This only applies at the top level. */ |
2347 | flags &= ~LOOKUP_DEFAULTED((((((((1 << 6) << 1) << 1) << 1) << 1) << 1) << 1) << 1); |
2348 | } |
2349 | |
2350 | if (! viable) |
2351 | goto out; |
2352 | |
2353 | /* Third, for F to be a viable function, there shall exist for each |
2354 | argument an implicit conversion sequence that converts that argument |
2355 | to the corresponding parameter of F. */ |
2356 | |
2357 | parmnode = parmlist; |
2358 | |
2359 | for (i = 0; i < len; ++i) |
2360 | { |
2361 | tree argtype, to_type; |
2362 | tree arg; |
2363 | conversion *t; |
2364 | int is_this; |
2365 | |
2366 | if (parmnode == void_list_nodeglobal_trees[TI_VOID_LIST_NODE]) |
2367 | break; |
2368 | |
2369 | if (convs[i]) |
2370 | { |
2371 | /* Already set during deduction. */ |
2372 | parmnode = TREE_CHAIN (parmnode)((contains_struct_check ((parmnode), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2372, __FUNCTION__))->common.chain); |
2373 | continue; |
2374 | } |
2375 | |
2376 | if (i == 0 && first_arg != NULL_TREE(tree) __null) |
2377 | arg = first_arg; |
2378 | else |
2379 | arg = CONST_CAST_TREE ((const_cast<union tree_node *> ((((*args)[i + skip - (first_arg != (tree) __null ? 1 : 0)])))) |
2380 | (*args)[i + skip - (first_arg != NULL_TREE ? 1 : 0)])(const_cast<union tree_node *> ((((*args)[i + skip - (first_arg != (tree) __null ? 1 : 0)])))); |
2381 | argtype = lvalue_type (arg); |
2382 | |
2383 | is_this = (i == 0 && DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)(((enum tree_code) (((contains_struct_check ((fn), (TS_TYPED) , "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2383, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE ) |
2384 | && ! DECL_CONSTRUCTOR_P (fn)((tree_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2384, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn) ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2384, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor )); |
2385 | |
2386 | if (parmnode) |
2387 | { |
2388 | tree parmtype = TREE_VALUE (parmnode)((tree_check ((parmnode), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2388, __FUNCTION__, (TREE_LIST)))->list.value); |
2389 | |
2390 | parmnode = TREE_CHAIN (parmnode)((contains_struct_check ((parmnode), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2390, __FUNCTION__))->common.chain); |
2391 | |
2392 | /* The type of the implicit object parameter ('this') for |
2393 | overload resolution is not always the same as for the |
2394 | function itself; conversion functions are considered to |
2395 | be members of the class being converted, and functions |
2396 | introduced by a using-declaration are considered to be |
2397 | members of the class that uses them. |
2398 | |
2399 | Since build_over_call ignores the ICS for the `this' |
2400 | parameter, we can just change the parm type. */ |
2401 | if (ctype && is_this) |
2402 | { |
2403 | parmtype = cp_build_qualified_typecp_build_qualified_type_real ((ctype), (cp_type_quals (((contains_struct_check ((parmtype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2404, __FUNCTION__))->typed.type))), tf_warning_or_error ) |
2404 | (ctype, cp_type_quals (TREE_TYPE (parmtype)))cp_build_qualified_type_real ((ctype), (cp_type_quals (((contains_struct_check ((parmtype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2404, __FUNCTION__))->typed.type))), tf_warning_or_error ); |
2405 | if (FUNCTION_REF_QUALIFIED (TREE_TYPE (fn))((tree_not_check2 (((tree_check2 ((((contains_struct_check (( fn), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2405, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2405, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2405, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_4)) |
2406 | { |
2407 | /* If the function has a ref-qualifier, the implicit |
2408 | object parameter has reference type. */ |
2409 | bool rv = FUNCTION_RVALUE_QUALIFIED (TREE_TYPE (fn))((tree_not_check2 (((tree_check2 ((((contains_struct_check (( fn), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2409, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2409, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2409, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_5); |
2410 | parmtype = cp_build_reference_type (parmtype, rv); |
2411 | /* The special handling of 'this' conversions in compare_ics |
2412 | does not apply if there is a ref-qualifier. */ |
2413 | is_this = false; |
2414 | } |
2415 | else |
2416 | { |
2417 | parmtype = build_pointer_type (parmtype); |
2418 | /* We don't use build_this here because we don't want to |
2419 | capture the object argument until we've chosen a |
2420 | non-static member function. */ |
2421 | arg = build_address (arg); |
2422 | argtype = lvalue_type (arg); |
2423 | } |
2424 | } |
2425 | |
2426 | int lflags = conv_flags (i, len-skip, fn, arg, flags); |
2427 | |
2428 | t = implicit_conversion (parmtype, argtype, arg, |
2429 | /*c_cast_p=*/false, lflags, complain); |
2430 | to_type = parmtype; |
2431 | } |
2432 | else |
2433 | { |
2434 | t = build_identity_conv (argtype, arg); |
2435 | t->ellipsis_p = true; |
2436 | to_type = argtype; |
2437 | } |
2438 | |
2439 | if (t && is_this) |
2440 | t->this_p = true; |
2441 | |
2442 | convs[i] = t; |
2443 | if (! t) |
2444 | { |
2445 | viable = 0; |
2446 | reason = arg_conversion_rejection (first_arg, i, argtype, to_type, |
2447 | EXPR_LOCATION (arg)((((arg)) && ((tree_code_type[(int) (((enum tree_code ) ((arg))->base.code))]) >= tcc_reference && (tree_code_type [(int) (((enum tree_code) ((arg))->base.code))]) <= tcc_expression )) ? (arg)->exp.locus : ((location_t) 0))); |
2448 | break; |
2449 | } |
2450 | |
2451 | if (t->bad_p) |
2452 | { |
2453 | viable = -1; |
2454 | reason = bad_arg_conversion_rejection (first_arg, i, arg, to_type, |
2455 | EXPR_LOCATION (arg)((((arg)) && ((tree_code_type[(int) (((enum tree_code ) ((arg))->base.code))]) >= tcc_reference && (tree_code_type [(int) (((enum tree_code) ((arg))->base.code))]) <= tcc_expression )) ? (arg)->exp.locus : ((location_t) 0))); |
2456 | |
2457 | } |
2458 | } |
2459 | |
2460 | out: |
2461 | return add_candidate (candidates, fn, orig_first_arg, args, len, convs, |
2462 | access_path, conversion_path, viable, reason, flags); |
2463 | } |
2464 | |
2465 | /* Create an overload candidate for the conversion function FN which will |
2466 | be invoked for expression OBJ, producing a pointer-to-function which |
2467 | will in turn be called with the argument list FIRST_ARG/ARGLIST, |
2468 | and add it to CANDIDATES. This does not change ARGLIST. FLAGS is |
2469 | passed on to implicit_conversion. |
2470 | |
2471 | Actually, we don't really care about FN; we care about the type it |
2472 | converts to. There may be multiple conversion functions that will |
2473 | convert to that type, and we rely on build_user_type_conversion_1 to |
2474 | choose the best one; so when we create our candidate, we record the type |
2475 | instead of the function. */ |
2476 | |
2477 | static struct z_candidate * |
2478 | add_conv_candidate (struct z_candidate **candidates, tree fn, tree obj, |
2479 | const vec<tree, va_gc> *arglist, |
2480 | tree access_path, tree conversion_path, |
2481 | tsubst_flags_t complain) |
2482 | { |
2483 | tree totype = TREE_TYPE (TREE_TYPE (fn))((contains_struct_check ((((contains_struct_check ((fn), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2483, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2483, __FUNCTION__))->typed.type); |
2484 | int i, len, viable, flags; |
2485 | tree parmlist, parmnode; |
2486 | conversion **convs; |
2487 | struct rejection_reason *reason; |
2488 | |
2489 | for (parmlist = totype; TREE_CODE (parmlist)((enum tree_code) (parmlist)->base.code) != FUNCTION_TYPE; ) |
2490 | parmlist = TREE_TYPE (parmlist)((contains_struct_check ((parmlist), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2490, __FUNCTION__))->typed.type); |
2491 | parmlist = TYPE_ARG_TYPES (parmlist)((tree_check2 ((parmlist), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2491, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values); |
2492 | |
2493 | len = vec_safe_length (arglist) + 1; |
2494 | convs = alloc_conversions (len); |
2495 | parmnode = parmlist; |
2496 | viable = 1; |
2497 | flags = LOOKUP_IMPLICIT(((1 << 0)) | (1 << 2)); |
2498 | reason = NULL__null; |
2499 | |
2500 | /* Don't bother looking up the same type twice. */ |
2501 | if (*candidates && (*candidates)->fn == totype) |
2502 | return NULL__null; |
2503 | |
2504 | for (i = 0; i < len; ++i) |
2505 | { |
2506 | tree arg, argtype, convert_type = NULL_TREE(tree) __null; |
2507 | conversion *t; |
2508 | |
2509 | if (i == 0) |
2510 | arg = obj; |
2511 | else |
2512 | arg = (*arglist)[i - 1]; |
2513 | argtype = lvalue_type (arg); |
2514 | |
2515 | if (i == 0) |
2516 | { |
2517 | t = build_identity_conv (argtype, NULL_TREE(tree) __null); |
2518 | t = build_conv (ck_user, totype, t); |
2519 | /* Leave the 'cand' field null; we'll figure out the conversion in |
2520 | convert_like if this candidate is chosen. */ |
2521 | convert_type = totype; |
2522 | } |
2523 | else if (parmnode == void_list_nodeglobal_trees[TI_VOID_LIST_NODE]) |
2524 | break; |
2525 | else if (parmnode) |
2526 | { |
2527 | t = implicit_conversion (TREE_VALUE (parmnode)((tree_check ((parmnode), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2527, __FUNCTION__, (TREE_LIST)))->list.value), argtype, arg, |
2528 | /*c_cast_p=*/false, flags, complain); |
2529 | convert_type = TREE_VALUE (parmnode)((tree_check ((parmnode), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2529, __FUNCTION__, (TREE_LIST)))->list.value); |
2530 | } |
2531 | else |
2532 | { |
2533 | t = build_identity_conv (argtype, arg); |
2534 | t->ellipsis_p = true; |
2535 | convert_type = argtype; |
2536 | } |
2537 | |
2538 | convs[i] = t; |
2539 | if (! t) |
2540 | break; |
2541 | |
2542 | if (t->bad_p) |
2543 | { |
2544 | viable = -1; |
2545 | reason = bad_arg_conversion_rejection (NULL_TREE(tree) __null, i, arg, convert_type, |
2546 | EXPR_LOCATION (arg)((((arg)) && ((tree_code_type[(int) (((enum tree_code ) ((arg))->base.code))]) >= tcc_reference && (tree_code_type [(int) (((enum tree_code) ((arg))->base.code))]) <= tcc_expression )) ? (arg)->exp.locus : ((location_t) 0))); |
2547 | } |
2548 | |
2549 | if (i == 0) |
2550 | continue; |
2551 | |
2552 | if (parmnode) |
2553 | parmnode = TREE_CHAIN (parmnode)((contains_struct_check ((parmnode), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2553, __FUNCTION__))->common.chain); |
2554 | } |
2555 | |
2556 | if (i < len |
2557 | || ! sufficient_parms_p (parmnode)) |
2558 | { |
2559 | int remaining = remaining_arguments (parmnode); |
2560 | viable = 0; |
2561 | reason = arity_rejection (NULL_TREE(tree) __null, i + remaining, len); |
2562 | } |
2563 | |
2564 | return add_candidate (candidates, totype, obj, arglist, len, convs, |
2565 | access_path, conversion_path, viable, reason, flags); |
2566 | } |
2567 | |
2568 | static void |
2569 | build_builtin_candidate (struct z_candidate **candidates, tree fnname, |
2570 | tree type1, tree type2, const vec<tree,va_gc> &args, |
2571 | tree *argtypes, int flags, tsubst_flags_t complain) |
2572 | { |
2573 | conversion *t; |
2574 | conversion **convs; |
2575 | size_t num_convs; |
2576 | int viable = 1; |
2577 | tree types[2]; |
2578 | struct rejection_reason *reason = NULL__null; |
2579 | |
2580 | types[0] = type1; |
2581 | types[1] = type2; |
2582 | |
2583 | num_convs = args.length (); |
2584 | convs = alloc_conversions (num_convs); |
2585 | |
2586 | /* TRUTH_*_EXPR do "contextual conversion to bool", which means explicit |
2587 | conversion ops are allowed. We handle that here by just checking for |
2588 | boolean_type_node because other operators don't ask for it. COND_EXPR |
2589 | also does contextual conversion to bool for the first operand, but we |
2590 | handle that in build_conditional_expr, and type1 here is operand 2. */ |
2591 | if (type1 != boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE]) |
2592 | flags |= LOOKUP_ONLYCONVERTING(1 << 2); |
2593 | |
2594 | for (unsigned i = 0; i < 2 && i < num_convs; ++i) |
2595 | { |
2596 | t = implicit_conversion (types[i], argtypes[i], args[i], |
2597 | /*c_cast_p=*/false, flags, complain); |
2598 | if (! t) |
2599 | { |
2600 | viable = 0; |
2601 | /* We need something for printing the candidate. */ |
2602 | t = build_identity_conv (types[i], NULL_TREE(tree) __null); |
2603 | reason = arg_conversion_rejection (NULL_TREE(tree) __null, i, argtypes[i], |
2604 | types[i], EXPR_LOCATION (args[i])((((args[i])) && ((tree_code_type[(int) (((enum tree_code ) ((args[i]))->base.code))]) >= tcc_reference && (tree_code_type[(int) (((enum tree_code) ((args[i]))->base .code))]) <= tcc_expression)) ? (args[i])->exp.locus : ( (location_t) 0))); |
2605 | } |
2606 | else if (t->bad_p) |
2607 | { |
2608 | viable = 0; |
2609 | reason = bad_arg_conversion_rejection (NULL_TREE(tree) __null, i, args[i], |
2610 | types[i], |
2611 | EXPR_LOCATION (args[i])((((args[i])) && ((tree_code_type[(int) (((enum tree_code ) ((args[i]))->base.code))]) >= tcc_reference && (tree_code_type[(int) (((enum tree_code) ((args[i]))->base .code))]) <= tcc_expression)) ? (args[i])->exp.locus : ( (location_t) 0))); |
2612 | } |
2613 | convs[i] = t; |
2614 | } |
2615 | |
2616 | /* For COND_EXPR we rearranged the arguments; undo that now. */ |
2617 | if (num_convs == 3) |
2618 | { |
2619 | convs[2] = convs[1]; |
2620 | convs[1] = convs[0]; |
2621 | t = implicit_conversion (boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], argtypes[2], args[2], |
2622 | /*c_cast_p=*/false, flags, |
2623 | complain); |
2624 | if (t) |
2625 | convs[0] = t; |
2626 | else |
2627 | { |
2628 | viable = 0; |
2629 | reason = arg_conversion_rejection (NULL_TREE(tree) __null, 0, argtypes[2], |
2630 | boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], |
2631 | EXPR_LOCATION (args[2])((((args[2])) && ((tree_code_type[(int) (((enum tree_code ) ((args[2]))->base.code))]) >= tcc_reference && (tree_code_type[(int) (((enum tree_code) ((args[2]))->base .code))]) <= tcc_expression)) ? (args[2])->exp.locus : ( (location_t) 0))); |
2632 | } |
2633 | } |
2634 | |
2635 | add_candidate (candidates, fnname, /*first_arg=*/NULL_TREE(tree) __null, /*args=*/NULL__null, |
2636 | num_convs, convs, |
2637 | /*access_path=*/NULL_TREE(tree) __null, |
2638 | /*conversion_path=*/NULL_TREE(tree) __null, |
2639 | viable, reason, flags); |
2640 | } |
2641 | |
2642 | static bool |
2643 | is_complete (tree t) |
2644 | { |
2645 | return COMPLETE_TYPE_P (complete_type (t))(((tree_class_check ((complete_type (t)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2645, __FUNCTION__))->type_common.size) != (tree) __null ); |
2646 | } |
2647 | |
2648 | /* Returns nonzero if TYPE is a promoted arithmetic type. */ |
2649 | |
2650 | static bool |
2651 | promoted_arithmetic_type_p (tree type) |
2652 | { |
2653 | /* [over.built] |
2654 | |
2655 | In this section, the term promoted integral type is used to refer |
2656 | to those integral types which are preserved by integral promotion |
2657 | (including e.g. int and long but excluding e.g. char). |
2658 | Similarly, the term promoted arithmetic type refers to promoted |
2659 | integral types plus floating types. */ |
2660 | return ((CP_INTEGRAL_TYPE_P (type)(((enum tree_code) (type)->base.code) == BOOLEAN_TYPE || ( (enum tree_code) (type)->base.code) == INTEGER_TYPE) |
2661 | && same_type_p (type_promotes_to (type), type)comptypes ((type_promotes_to (type)), (type), 0)) |
2662 | || TREE_CODE (type)((enum tree_code) (type)->base.code) == REAL_TYPE); |
2663 | } |
2664 | |
2665 | /* Create any builtin operator overload candidates for the operator in |
2666 | question given the converted operand types TYPE1 and TYPE2. The other |
2667 | args are passed through from add_builtin_candidates to |
2668 | build_builtin_candidate. |
2669 | |
2670 | TYPE1 and TYPE2 may not be permissible, and we must filter them. |
2671 | If CODE is requires candidates operands of the same type of the kind |
2672 | of which TYPE1 and TYPE2 are, we add both candidates |
2673 | CODE (TYPE1, TYPE1) and CODE (TYPE2, TYPE2). */ |
2674 | |
2675 | static void |
2676 | add_builtin_candidate (struct z_candidate **candidates, enum tree_code code, |
2677 | enum tree_code code2, tree fnname, tree type1, |
2678 | tree type2, vec<tree,va_gc> &args, tree *argtypes, |
2679 | int flags, tsubst_flags_t complain) |
2680 | { |
2681 | switch (code) |
2682 | { |
2683 | case POSTINCREMENT_EXPR: |
2684 | case POSTDECREMENT_EXPR: |
2685 | args[1] = integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]; |
2686 | type2 = integer_type_nodeinteger_types[itk_int]; |
2687 | break; |
2688 | default: |
2689 | break; |
2690 | } |
2691 | |
2692 | switch (code) |
2693 | { |
2694 | |
2695 | /* 4 For every pair (T, VQ), where T is an arithmetic type other than bool, |
2696 | and VQ is either volatile or empty, there exist candidate operator |
2697 | functions of the form |
2698 | VQ T& operator++(VQ T&); |
2699 | T operator++(VQ T&, int); |
2700 | 5 For every pair (T, VQ), where T is an arithmetic type other than bool, |
2701 | and VQ is either volatile or empty, there exist candidate operator |
2702 | functions of the form |
2703 | VQ T& operator--(VQ T&); |
2704 | T operator--(VQ T&, int); |
2705 | 6 For every pair (T, VQ), where T is a cv-qualified or cv-unqualified object |
2706 | type, and VQ is either volatile or empty, there exist candidate operator |
2707 | functions of the form |
2708 | T*VQ& operator++(T*VQ&); |
2709 | T*VQ& operator--(T*VQ&); |
2710 | T* operator++(T*VQ&, int); |
2711 | T* operator--(T*VQ&, int); */ |
2712 | |
2713 | case POSTDECREMENT_EXPR: |
2714 | case PREDECREMENT_EXPR: |
2715 | if (TREE_CODE (type1)((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE) |
2716 | return; |
2717 | /* FALLTHRU */ |
2718 | case POSTINCREMENT_EXPR: |
2719 | case PREINCREMENT_EXPR: |
2720 | /* P0002R1, Remove deprecated operator++(bool) added "other than bool" |
2721 | to p4. */ |
2722 | if (TREE_CODE (type1)((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE && cxx_dialect >= cxx17) |
2723 | return; |
2724 | if (ARITHMETIC_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type1)->base.code) == INTEGER_TYPE) || ((enum tree_code) (type1)->base.code) == REAL_TYPE || ((enum tree_code) (type1)->base.code) == COMPLEX_TYPE) || TYPE_PTROB_P (type1)((((enum tree_code) (type1)->base.code) == POINTER_TYPE) && (!(((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2724, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE ) && !(((enum tree_code) (((contains_struct_check ((type1 ), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2724, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE ) && !(((enum tree_code) (((contains_struct_check ((type1 ), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2724, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE || ((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2724, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE )))) |
2725 | { |
2726 | type1 = build_reference_type (type1); |
2727 | break; |
2728 | } |
2729 | return; |
2730 | |
2731 | /* 7 For every cv-qualified or cv-unqualified object type T, there |
2732 | exist candidate operator functions of the form |
2733 | |
2734 | T& operator*(T*); |
2735 | |
2736 | |
2737 | 8 For every function type T that does not have cv-qualifiers or |
2738 | a ref-qualifier, there exist candidate operator functions of the form |
2739 | T& operator*(T*); */ |
2740 | |
2741 | case INDIRECT_REF: |
2742 | if (TYPE_PTR_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE) |
2743 | && (TYPE_PTROB_P (type1)((((enum tree_code) (type1)->base.code) == POINTER_TYPE) && (!(((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2743, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE ) && !(((enum tree_code) (((contains_struct_check ((type1 ), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2743, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE ) && !(((enum tree_code) (((contains_struct_check ((type1 ), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2743, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE || ((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2743, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE ))) |
2744 | || TREE_CODE (TREE_TYPE (type1))((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2744, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE)) |
2745 | break; |
2746 | return; |
2747 | |
2748 | /* 9 For every type T, there exist candidate operator functions of the form |
2749 | T* operator+(T*); |
2750 | |
2751 | 10 For every floating-point or promoted integral type T, there exist |
2752 | candidate operator functions of the form |
2753 | T operator+(T); |
2754 | T operator-(T); */ |
2755 | |
2756 | case UNARY_PLUS_EXPR: /* unary + */ |
2757 | if (TYPE_PTR_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE)) |
2758 | break; |
2759 | /* FALLTHRU */ |
2760 | case NEGATE_EXPR: |
2761 | if (ARITHMETIC_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type1)->base.code) == INTEGER_TYPE) || ((enum tree_code) (type1)->base.code) == REAL_TYPE || ((enum tree_code) (type1)->base.code) == COMPLEX_TYPE)) |
2762 | break; |
2763 | return; |
2764 | |
2765 | /* 11 For every promoted integral type T, there exist candidate operator |
2766 | functions of the form |
2767 | T operator~(T); */ |
2768 | |
2769 | case BIT_NOT_EXPR: |
2770 | if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == ENUMERAL_TYPE && !((tree_check ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2770, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag) ) || (((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type1)->base.code) == INTEGER_TYPE) )) |
2771 | break; |
2772 | return; |
2773 | |
2774 | /* 12 For every quintuple (C1, C2, T, CV1, CV2), where C2 is a class type, C1 |
2775 | is the same type as C2 or is a derived class of C2, and T is an object |
2776 | type or a function type there exist candidate operator functions of the |
2777 | form |
2778 | CV12 T& operator->*(CV1 C1*, CV2 T C2::*); |
2779 | where CV12 is the union of CV1 and CV2. */ |
2780 | |
2781 | case MEMBER_REF: |
2782 | if (TYPE_PTR_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE) && TYPE_PTRMEM_P (type2)((((enum tree_code) (type2)->base.code) == OFFSET_TYPE) || (((enum tree_code) (type2)->base.code) == RECORD_TYPE && (((tree_class_check (((tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2782, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2782, __FUNCTION__))->type_common.lang_flag_2))))) |
2783 | { |
2784 | tree c1 = TREE_TYPE (type1)((contains_struct_check ((type1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2784, __FUNCTION__))->typed.type); |
2785 | tree c2 = TYPE_PTRMEM_CLASS_TYPE (type2)((((enum tree_code) (type2)->base.code) == OFFSET_TYPE) ? ( (tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2785, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval ) : ((tree_check2 ((((contains_struct_check (((cp_build_qualified_type_real ((((contains_struct_check ((((tree_check3 ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2785, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2785, __FUNCTION__))->typed.type)), (cp_type_quals (type2 )), tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2785, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2785, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .maxval)); |
2786 | |
2787 | if (MAYBE_CLASS_TYPE_P (c1)((((enum tree_code) (c1)->base.code) == TEMPLATE_TYPE_PARM || ((enum tree_code) (c1)->base.code) == TYPENAME_TYPE || ((enum tree_code) (c1)->base.code) == TYPEOF_TYPE || ((enum tree_code) (c1)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM || ((enum tree_code) (c1)->base.code) == DECLTYPE_TYPE) || (((((enum tree_code) (c1)->base.code)) == RECORD_TYPE || ( ((enum tree_code) (c1)->base.code)) == UNION_TYPE) && ((tree_class_check ((c1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2787, __FUNCTION__))->type_common.lang_flag_5))) && DERIVED_FROM_P (c2, c1)(lookup_base ((c1), (c2), ba_any, __null, tf_none) != (tree) __null ) |
2788 | && (TYPE_PTRMEMFUNC_P (type2)(((enum tree_code) (type2)->base.code) == RECORD_TYPE && (((tree_class_check (((tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2788, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2788, __FUNCTION__))->type_common.lang_flag_2))) |
2789 | || is_complete (TYPE_PTRMEM_POINTED_TO_TYPE (type2)((((enum tree_code) (type2)->base.code) == OFFSET_TYPE) ? ( (contains_struct_check ((type2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2789, __FUNCTION__))->typed.type) : ((contains_struct_check (((cp_build_qualified_type_real ((((contains_struct_check (( ((tree_check3 ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2789, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2789, __FUNCTION__))->typed.type)), (cp_type_quals (type2 )), tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2789, __FUNCTION__))->typed.type))))) |
2790 | break; |
2791 | } |
2792 | return; |
2793 | |
2794 | /* 13 For every pair of types L and R, where each of L and R is a floating-point |
2795 | or promoted integral type, there exist candidate operator functions of the |
2796 | form |
2797 | LR operator*(L, R); |
2798 | LR operator/(L, R); |
2799 | LR operator+(L, R); |
2800 | LR operator-(L, R); |
2801 | bool operator<(L, R); |
2802 | bool operator>(L, R); |
2803 | bool operator<=(L, R); |
2804 | bool operator>=(L, R); |
2805 | bool operator==(L, R); |
2806 | bool operator!=(L, R); |
2807 | where LR is the result of the usual arithmetic conversions between |
2808 | types L and R. |
2809 | |
2810 | 14 For every integral type T there exists a candidate operator function of |
2811 | the form |
2812 | |
2813 | std::strong_ordering operator<=>(T, T); |
2814 | |
2815 | 15 For every pair of floating-point types L and R, there exists a candidate |
2816 | operator function of the form |
2817 | |
2818 | std::partial_ordering operator<=>(L, R); |
2819 | |
2820 | 16 For every cv-qualified or cv-unqualified object type T there exist |
2821 | candidate operator functions of the form |
2822 | T* operator+(T*, std::ptrdiff_t); |
2823 | T& operator[](T*, std::ptrdiff_t); |
2824 | T* operator-(T*, std::ptrdiff_t); |
2825 | T* operator+(std::ptrdiff_t, T*); |
2826 | T& operator[](std::ptrdiff_t, T*); |
2827 | |
2828 | 17 For every T, where T is a pointer to object type, there exist candidate |
2829 | operator functions of the form |
2830 | std::ptrdiff_t operator-(T, T); |
2831 | |
2832 | 18 For every T, where T is an enumeration type or a pointer type, there |
2833 | exist candidate operator functions of the form |
2834 | bool operator<(T, T); |
2835 | bool operator>(T, T); |
2836 | bool operator<=(T, T); |
2837 | bool operator>=(T, T); |
2838 | bool operator==(T, T); |
2839 | bool operator!=(T, T); |
2840 | R operator<=>(T, T); |
2841 | |
2842 | where R is the result type specified in [expr.spaceship]. |
2843 | |
2844 | 19 For every T, where T is a pointer-to-member type or std::nullptr_t, |
2845 | there exist candidate operator functions of the form |
2846 | bool operator==(T, T); |
2847 | bool operator!=(T, T); */ |
2848 | |
2849 | case MINUS_EXPR: |
2850 | if (TYPE_PTROB_P (type1)((((enum tree_code) (type1)->base.code) == POINTER_TYPE) && (!(((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2850, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE ) && !(((enum tree_code) (((contains_struct_check ((type1 ), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2850, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE ) && !(((enum tree_code) (((contains_struct_check ((type1 ), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2850, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE || ((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2850, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE ))) && TYPE_PTROB_P (type2)((((enum tree_code) (type2)->base.code) == POINTER_TYPE) && (!(((enum tree_code) (((contains_struct_check ((type2), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2850, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE ) && !(((enum tree_code) (((contains_struct_check ((type2 ), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2850, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE ) && !(((enum tree_code) (((contains_struct_check ((type2 ), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2850, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE || ((enum tree_code) (((contains_struct_check ((type2), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2850, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE )))) |
2851 | break; |
2852 | if (TYPE_PTROB_P (type1)((((enum tree_code) (type1)->base.code) == POINTER_TYPE) && (!(((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2852, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE ) && !(((enum tree_code) (((contains_struct_check ((type1 ), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2852, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE ) && !(((enum tree_code) (((contains_struct_check ((type1 ), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2852, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE || ((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2852, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE ))) |
2853 | && INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type2)((((enum tree_code) (type2)->base.code) == ENUMERAL_TYPE && !((tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2853, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag) ) || (((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type2)->base.code) == INTEGER_TYPE) )) |
2854 | { |
2855 | type2 = ptrdiff_type_nodeglobal_trees[TI_PTRDIFF_TYPE]; |
2856 | break; |
2857 | } |
2858 | /* FALLTHRU */ |
2859 | case MULT_EXPR: |
2860 | case TRUNC_DIV_EXPR: |
2861 | if (ARITHMETIC_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type1)->base.code) == INTEGER_TYPE) || ((enum tree_code) (type1)->base.code) == REAL_TYPE || ((enum tree_code) (type1)->base.code) == COMPLEX_TYPE) && ARITHMETIC_TYPE_P (type2)((((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type2)->base.code) == INTEGER_TYPE) || ((enum tree_code) (type2)->base.code) == REAL_TYPE || ((enum tree_code) (type2)->base.code) == COMPLEX_TYPE)) |
2862 | break; |
2863 | return; |
2864 | |
2865 | /* This isn't exactly what's specified above for operator<=>, but it's |
2866 | close enough. In particular, we don't care about the return type |
2867 | specified above; it doesn't participate in overload resolution and it |
2868 | doesn't affect the semantics of the built-in operator. */ |
2869 | case SPACESHIP_EXPR: |
2870 | case EQ_EXPR: |
2871 | case NE_EXPR: |
2872 | if ((TYPE_PTRMEMFUNC_P (type1)(((enum tree_code) (type1)->base.code) == RECORD_TYPE && (((tree_class_check (((tree_check ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2872, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2872, __FUNCTION__))->type_common.lang_flag_2))) && TYPE_PTRMEMFUNC_P (type2)(((enum tree_code) (type2)->base.code) == RECORD_TYPE && (((tree_class_check (((tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2872, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2872, __FUNCTION__))->type_common.lang_flag_2)))) |
2873 | || (TYPE_PTRDATAMEM_P (type1)(((enum tree_code) (type1)->base.code) == OFFSET_TYPE) && TYPE_PTRDATAMEM_P (type2)(((enum tree_code) (type2)->base.code) == OFFSET_TYPE))) |
2874 | break; |
2875 | if (NULLPTR_TYPE_P (type1)(((enum tree_code) (type1)->base.code) == NULLPTR_TYPE) && NULLPTR_TYPE_P (type2)(((enum tree_code) (type2)->base.code) == NULLPTR_TYPE)) |
2876 | break; |
2877 | if (TYPE_PTRMEM_P (type1)((((enum tree_code) (type1)->base.code) == OFFSET_TYPE) || (((enum tree_code) (type1)->base.code) == RECORD_TYPE && (((tree_class_check (((tree_check ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2877, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2877, __FUNCTION__))->type_common.lang_flag_2)))) && null_ptr_cst_p (args[1])) |
2878 | { |
2879 | type2 = type1; |
2880 | break; |
2881 | } |
2882 | if (TYPE_PTRMEM_P (type2)((((enum tree_code) (type2)->base.code) == OFFSET_TYPE) || (((enum tree_code) (type2)->base.code) == RECORD_TYPE && (((tree_class_check (((tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2882, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2882, __FUNCTION__))->type_common.lang_flag_2)))) && null_ptr_cst_p (args[0])) |
2883 | { |
2884 | type1 = type2; |
2885 | break; |
2886 | } |
2887 | /* Fall through. */ |
2888 | case LT_EXPR: |
2889 | case GT_EXPR: |
2890 | case LE_EXPR: |
2891 | case GE_EXPR: |
2892 | case MAX_EXPR: |
2893 | case MIN_EXPR: |
2894 | if (ARITHMETIC_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type1)->base.code) == INTEGER_TYPE) || ((enum tree_code) (type1)->base.code) == REAL_TYPE || ((enum tree_code) (type1)->base.code) == COMPLEX_TYPE) && ARITHMETIC_TYPE_P (type2)((((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type2)->base.code) == INTEGER_TYPE) || ((enum tree_code) (type2)->base.code) == REAL_TYPE || ((enum tree_code) (type2)->base.code) == COMPLEX_TYPE)) |
2895 | break; |
2896 | if (TYPE_PTR_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE) && TYPE_PTR_P (type2)(((enum tree_code) (type2)->base.code) == POINTER_TYPE)) |
2897 | break; |
2898 | if (TREE_CODE (type1)((enum tree_code) (type1)->base.code) == ENUMERAL_TYPE |
2899 | && TREE_CODE (type2)((enum tree_code) (type2)->base.code) == ENUMERAL_TYPE) |
2900 | break; |
2901 | if (TYPE_PTR_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE) |
2902 | && null_ptr_cst_p (args[1])) |
2903 | { |
2904 | type2 = type1; |
2905 | break; |
2906 | } |
2907 | if (null_ptr_cst_p (args[0]) |
2908 | && TYPE_PTR_P (type2)(((enum tree_code) (type2)->base.code) == POINTER_TYPE)) |
2909 | { |
2910 | type1 = type2; |
2911 | break; |
2912 | } |
2913 | return; |
2914 | |
2915 | case PLUS_EXPR: |
2916 | if (ARITHMETIC_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type1)->base.code) == INTEGER_TYPE) || ((enum tree_code) (type1)->base.code) == REAL_TYPE || ((enum tree_code) (type1)->base.code) == COMPLEX_TYPE) && ARITHMETIC_TYPE_P (type2)((((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type2)->base.code) == INTEGER_TYPE) || ((enum tree_code) (type2)->base.code) == REAL_TYPE || ((enum tree_code) (type2)->base.code) == COMPLEX_TYPE)) |
2917 | break; |
2918 | /* FALLTHRU */ |
2919 | case ARRAY_REF: |
2920 | if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == ENUMERAL_TYPE && !((tree_check ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2920, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag) ) || (((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type1)->base.code) == INTEGER_TYPE) ) && TYPE_PTROB_P (type2)((((enum tree_code) (type2)->base.code) == POINTER_TYPE) && (!(((enum tree_code) (((contains_struct_check ((type2), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2920, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE ) && !(((enum tree_code) (((contains_struct_check ((type2 ), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2920, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE ) && !(((enum tree_code) (((contains_struct_check ((type2 ), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2920, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE || ((enum tree_code) (((contains_struct_check ((type2), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2920, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE )))) |
2921 | { |
2922 | type1 = ptrdiff_type_nodeglobal_trees[TI_PTRDIFF_TYPE]; |
2923 | break; |
2924 | } |
2925 | if (TYPE_PTROB_P (type1)((((enum tree_code) (type1)->base.code) == POINTER_TYPE) && (!(((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2925, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE ) && !(((enum tree_code) (((contains_struct_check ((type1 ), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2925, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE ) && !(((enum tree_code) (((contains_struct_check ((type1 ), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2925, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE || ((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2925, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE ))) && INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type2)((((enum tree_code) (type2)->base.code) == ENUMERAL_TYPE && !((tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2925, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag) ) || (((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type2)->base.code) == INTEGER_TYPE) )) |
2926 | { |
2927 | type2 = ptrdiff_type_nodeglobal_trees[TI_PTRDIFF_TYPE]; |
2928 | break; |
2929 | } |
2930 | return; |
2931 | |
2932 | /* 18For every pair of promoted integral types L and R, there exist candi- |
2933 | date operator functions of the form |
2934 | LR operator%(L, R); |
2935 | LR operator&(L, R); |
2936 | LR operator^(L, R); |
2937 | LR operator|(L, R); |
2938 | L operator<<(L, R); |
2939 | L operator>>(L, R); |
2940 | where LR is the result of the usual arithmetic conversions between |
2941 | types L and R. */ |
2942 | |
2943 | case TRUNC_MOD_EXPR: |
2944 | case BIT_AND_EXPR: |
2945 | case BIT_IOR_EXPR: |
2946 | case BIT_XOR_EXPR: |
2947 | case LSHIFT_EXPR: |
2948 | case RSHIFT_EXPR: |
2949 | if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == ENUMERAL_TYPE && !((tree_check ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2949, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag) ) || (((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type1)->base.code) == INTEGER_TYPE) ) && INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type2)((((enum tree_code) (type2)->base.code) == ENUMERAL_TYPE && !((tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2949, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag) ) || (((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type2)->base.code) == INTEGER_TYPE) )) |
2950 | break; |
2951 | return; |
2952 | |
2953 | /* 19For every triple L, VQ, R), where L is an arithmetic or enumeration |
2954 | type, VQ is either volatile or empty, and R is a promoted arithmetic |
2955 | type, there exist candidate operator functions of the form |
2956 | VQ L& operator=(VQ L&, R); |
2957 | VQ L& operator*=(VQ L&, R); |
2958 | VQ L& operator/=(VQ L&, R); |
2959 | VQ L& operator+=(VQ L&, R); |
2960 | VQ L& operator-=(VQ L&, R); |
2961 | |
2962 | 20For every pair T, VQ), where T is any type and VQ is either volatile |
2963 | or empty, there exist candidate operator functions of the form |
2964 | T*VQ& operator=(T*VQ&, T*); |
2965 | |
2966 | 21For every pair T, VQ), where T is a pointer to member type and VQ is |
2967 | either volatile or empty, there exist candidate operator functions of |
2968 | the form |
2969 | VQ T& operator=(VQ T&, T); |
2970 | |
2971 | 22For every triple T, VQ, I), where T is a cv-qualified or cv- |
2972 | unqualified complete object type, VQ is either volatile or empty, and |
2973 | I is a promoted integral type, there exist candidate operator func- |
2974 | tions of the form |
2975 | T*VQ& operator+=(T*VQ&, I); |
2976 | T*VQ& operator-=(T*VQ&, I); |
2977 | |
2978 | 23For every triple L, VQ, R), where L is an integral or enumeration |
2979 | type, VQ is either volatile or empty, and R is a promoted integral |
2980 | type, there exist candidate operator functions of the form |
2981 | |
2982 | VQ L& operator%=(VQ L&, R); |
2983 | VQ L& operator<<=(VQ L&, R); |
2984 | VQ L& operator>>=(VQ L&, R); |
2985 | VQ L& operator&=(VQ L&, R); |
2986 | VQ L& operator^=(VQ L&, R); |
2987 | VQ L& operator|=(VQ L&, R); */ |
2988 | |
2989 | case MODIFY_EXPR: |
2990 | switch (code2) |
2991 | { |
2992 | case PLUS_EXPR: |
2993 | case MINUS_EXPR: |
2994 | if (TYPE_PTROB_P (type1)((((enum tree_code) (type1)->base.code) == POINTER_TYPE) && (!(((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2994, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE ) && !(((enum tree_code) (((contains_struct_check ((type1 ), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2994, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE ) && !(((enum tree_code) (((contains_struct_check ((type1 ), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2994, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE || ((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2994, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE ))) && INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type2)((((enum tree_code) (type2)->base.code) == ENUMERAL_TYPE && !((tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 2994, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag) ) || (((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type2)->base.code) == INTEGER_TYPE) )) |
2995 | { |
2996 | type2 = ptrdiff_type_nodeglobal_trees[TI_PTRDIFF_TYPE]; |
2997 | break; |
2998 | } |
2999 | /* FALLTHRU */ |
3000 | case MULT_EXPR: |
3001 | case TRUNC_DIV_EXPR: |
3002 | if (ARITHMETIC_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type1)->base.code) == INTEGER_TYPE) || ((enum tree_code) (type1)->base.code) == REAL_TYPE || ((enum tree_code) (type1)->base.code) == COMPLEX_TYPE) && ARITHMETIC_TYPE_P (type2)((((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type2)->base.code) == INTEGER_TYPE) || ((enum tree_code) (type2)->base.code) == REAL_TYPE || ((enum tree_code) (type2)->base.code) == COMPLEX_TYPE)) |
3003 | break; |
3004 | return; |
3005 | |
3006 | case TRUNC_MOD_EXPR: |
3007 | case BIT_AND_EXPR: |
3008 | case BIT_IOR_EXPR: |
3009 | case BIT_XOR_EXPR: |
3010 | case LSHIFT_EXPR: |
3011 | case RSHIFT_EXPR: |
3012 | if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == ENUMERAL_TYPE && !((tree_check ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3012, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag) ) || (((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type1)->base.code) == INTEGER_TYPE) ) && INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type2)((((enum tree_code) (type2)->base.code) == ENUMERAL_TYPE && !((tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3012, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag) ) || (((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type2)->base.code) == INTEGER_TYPE) )) |
3013 | break; |
3014 | return; |
3015 | |
3016 | case NOP_EXPR: |
3017 | if (ARITHMETIC_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type1)->base.code) == INTEGER_TYPE) || ((enum tree_code) (type1)->base.code) == REAL_TYPE || ((enum tree_code) (type1)->base.code) == COMPLEX_TYPE) && ARITHMETIC_TYPE_P (type2)((((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type2)->base.code) == INTEGER_TYPE) || ((enum tree_code) (type2)->base.code) == REAL_TYPE || ((enum tree_code) (type2)->base.code) == COMPLEX_TYPE)) |
3018 | break; |
3019 | if ((TYPE_PTRMEMFUNC_P (type1)(((enum tree_code) (type1)->base.code) == RECORD_TYPE && (((tree_class_check (((tree_check ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3019, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3019, __FUNCTION__))->type_common.lang_flag_2))) && TYPE_PTRMEMFUNC_P (type2)(((enum tree_code) (type2)->base.code) == RECORD_TYPE && (((tree_class_check (((tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3019, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3019, __FUNCTION__))->type_common.lang_flag_2)))) |
3020 | || (TYPE_PTR_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE) && TYPE_PTR_P (type2)(((enum tree_code) (type2)->base.code) == POINTER_TYPE)) |
3021 | || (TYPE_PTRDATAMEM_P (type1)(((enum tree_code) (type1)->base.code) == OFFSET_TYPE) && TYPE_PTRDATAMEM_P (type2)(((enum tree_code) (type2)->base.code) == OFFSET_TYPE)) |
3022 | || ((TYPE_PTRMEMFUNC_P (type1)(((enum tree_code) (type1)->base.code) == RECORD_TYPE && (((tree_class_check (((tree_check ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3022, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3022, __FUNCTION__))->type_common.lang_flag_2))) |
3023 | || TYPE_PTR_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE)) |
3024 | && null_ptr_cst_p (args[1]))) |
3025 | { |
3026 | type2 = type1; |
3027 | break; |
3028 | } |
3029 | return; |
3030 | |
3031 | default: |
3032 | gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3032, __FUNCTION__)); |
3033 | } |
3034 | type1 = build_reference_type (type1); |
3035 | break; |
3036 | |
3037 | case COND_EXPR: |
3038 | /* [over.built] |
3039 | |
3040 | For every pair of promoted arithmetic types L and R, there |
3041 | exist candidate operator functions of the form |
3042 | |
3043 | LR operator?(bool, L, R); |
3044 | |
3045 | where LR is the result of the usual arithmetic conversions |
3046 | between types L and R. |
3047 | |
3048 | For every type T, where T is a pointer or pointer-to-member |
3049 | type, there exist candidate operator functions of the form T |
3050 | operator?(bool, T, T); */ |
3051 | |
3052 | if (promoted_arithmetic_type_p (type1) |
3053 | && promoted_arithmetic_type_p (type2)) |
3054 | /* That's OK. */ |
3055 | break; |
3056 | |
3057 | /* Otherwise, the types should be pointers. */ |
3058 | if (!TYPE_PTR_OR_PTRMEM_P (type1)((((enum tree_code) (type1)->base.code) == POINTER_TYPE) || ((((enum tree_code) (type1)->base.code) == OFFSET_TYPE) || (((enum tree_code) (type1)->base.code) == RECORD_TYPE && (((tree_class_check (((tree_check ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3058, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3058, __FUNCTION__))->type_common.lang_flag_2))))) || !TYPE_PTR_OR_PTRMEM_P (type2)((((enum tree_code) (type2)->base.code) == POINTER_TYPE) || ((((enum tree_code) (type2)->base.code) == OFFSET_TYPE) || (((enum tree_code) (type2)->base.code) == RECORD_TYPE && (((tree_class_check (((tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3058, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3058, __FUNCTION__))->type_common.lang_flag_2)))))) |
3059 | return; |
3060 | |
3061 | /* We don't check that the two types are the same; the logic |
3062 | below will actually create two candidates; one in which both |
3063 | parameter types are TYPE1, and one in which both parameter |
3064 | types are TYPE2. */ |
3065 | break; |
3066 | |
3067 | case REALPART_EXPR: |
3068 | case IMAGPART_EXPR: |
3069 | if (ARITHMETIC_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type1)->base.code) == INTEGER_TYPE) || ((enum tree_code) (type1)->base.code) == REAL_TYPE || ((enum tree_code) (type1)->base.code) == COMPLEX_TYPE)) |
3070 | break; |
3071 | return; |
3072 | |
3073 | default: |
3074 | gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3074, __FUNCTION__)); |
3075 | } |
3076 | |
3077 | /* Make sure we don't create builtin candidates with dependent types. */ |
3078 | bool u1 = uses_template_parms (type1); |
3079 | bool u2 = type2 ? uses_template_parms (type2) : false; |
3080 | if (u1 || u2) |
3081 | { |
3082 | /* Try to recover if one of the types is non-dependent. But if |
3083 | there's only one type, there's nothing we can do. */ |
3084 | if (!type2) |
3085 | return; |
3086 | /* And we lose if both are dependent. */ |
3087 | if (u1 && u2) |
3088 | return; |
3089 | /* Or if they have different forms. */ |
3090 | if (TREE_CODE (type1)((enum tree_code) (type1)->base.code) != TREE_CODE (type2)((enum tree_code) (type2)->base.code)) |
3091 | return; |
3092 | |
3093 | if (u1 && !u2) |
3094 | type1 = type2; |
3095 | else if (u2 && !u1) |
3096 | type2 = type1; |
3097 | } |
3098 | |
3099 | /* If we're dealing with two pointer types or two enumeral types, |
3100 | we need candidates for both of them. */ |
3101 | if (type2 && !same_type_p (type1, type2)comptypes ((type1), (type2), 0) |
3102 | && TREE_CODE (type1)((enum tree_code) (type1)->base.code) == TREE_CODE (type2)((enum tree_code) (type2)->base.code) |
3103 | && (TYPE_REF_P (type1)(((enum tree_code) (type1)->base.code) == REFERENCE_TYPE) |
3104 | || (TYPE_PTR_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE) && TYPE_PTR_P (type2)(((enum tree_code) (type2)->base.code) == POINTER_TYPE)) |
3105 | || (TYPE_PTRDATAMEM_P (type1)(((enum tree_code) (type1)->base.code) == OFFSET_TYPE) && TYPE_PTRDATAMEM_P (type2)(((enum tree_code) (type2)->base.code) == OFFSET_TYPE)) |
3106 | || TYPE_PTRMEMFUNC_P (type1)(((enum tree_code) (type1)->base.code) == RECORD_TYPE && (((tree_class_check (((tree_check ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3106, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3106, __FUNCTION__))->type_common.lang_flag_2))) |
3107 | || MAYBE_CLASS_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == TEMPLATE_TYPE_PARM || ((enum tree_code) (type1)->base.code) == TYPENAME_TYPE || ((enum tree_code) (type1)->base.code) == TYPEOF_TYPE || ((enum tree_code) (type1)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM || ((enum tree_code) (type1)->base.code) == DECLTYPE_TYPE ) || (((((enum tree_code) (type1)->base.code)) == RECORD_TYPE || (((enum tree_code) (type1)->base.code)) == UNION_TYPE) && ((tree_class_check ((type1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3107, __FUNCTION__))->type_common.lang_flag_5))) |
3108 | || TREE_CODE (type1)((enum tree_code) (type1)->base.code) == ENUMERAL_TYPE)) |
3109 | { |
3110 | if (TYPE_PTR_OR_PTRMEM_P (type1)((((enum tree_code) (type1)->base.code) == POINTER_TYPE) || ((((enum tree_code) (type1)->base.code) == OFFSET_TYPE) || (((enum tree_code) (type1)->base.code) == RECORD_TYPE && (((tree_class_check (((tree_check ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3110, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3110, __FUNCTION__))->type_common.lang_flag_2)))))) |
3111 | { |
3112 | tree cptype = composite_pointer_type (input_location, |
3113 | type1, type2, |
3114 | error_mark_nodeglobal_trees[TI_ERROR_MARK], |
3115 | error_mark_nodeglobal_trees[TI_ERROR_MARK], |
3116 | CPO_CONVERSION, |
3117 | tf_none); |
3118 | if (cptype != error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
3119 | { |
3120 | build_builtin_candidate |
3121 | (candidates, fnname, cptype, cptype, args, argtypes, |
3122 | flags, complain); |
3123 | return; |
3124 | } |
3125 | } |
3126 | |
3127 | build_builtin_candidate |
3128 | (candidates, fnname, type1, type1, args, argtypes, flags, complain); |
3129 | build_builtin_candidate |
3130 | (candidates, fnname, type2, type2, args, argtypes, flags, complain); |
3131 | return; |
3132 | } |
3133 | |
3134 | build_builtin_candidate |
3135 | (candidates, fnname, type1, type2, args, argtypes, flags, complain); |
3136 | } |
3137 | |
3138 | tree |
3139 | type_decays_to (tree type) |
3140 | { |
3141 | if (TREE_CODE (type)((enum tree_code) (type)->base.code) == ARRAY_TYPE) |
3142 | return build_pointer_type (TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3142, __FUNCTION__))->typed.type)); |
3143 | if (TREE_CODE (type)((enum tree_code) (type)->base.code) == FUNCTION_TYPE) |
3144 | return build_pointer_type (type); |
3145 | return type; |
3146 | } |
3147 | |
3148 | /* There are three conditions of builtin candidates: |
3149 | |
3150 | 1) bool-taking candidates. These are the same regardless of the input. |
3151 | 2) pointer-pair taking candidates. These are generated for each type |
3152 | one of the input types converts to. |
3153 | 3) arithmetic candidates. According to the standard, we should generate |
3154 | all of these, but I'm trying not to... |
3155 | |
3156 | Here we generate a superset of the possible candidates for this particular |
3157 | case. That is a subset of the full set the standard defines, plus some |
3158 | other cases which the standard disallows. add_builtin_candidate will |
3159 | filter out the invalid set. */ |
3160 | |
3161 | static void |
3162 | add_builtin_candidates (struct z_candidate **candidates, enum tree_code code, |
3163 | enum tree_code code2, tree fnname, |
3164 | vec<tree, va_gc> *argv, |
3165 | int flags, tsubst_flags_t complain) |
3166 | { |
3167 | int ref1; |
3168 | int enum_p = 0; |
3169 | tree type, argtypes[3], t; |
3170 | /* TYPES[i] is the set of possible builtin-operator parameter types |
3171 | we will consider for the Ith argument. */ |
3172 | vec<tree, va_gc> *types[2]; |
3173 | unsigned ix; |
3174 | vec<tree, va_gc> &args = *argv; |
3175 | unsigned len = args.length (); |
3176 | |
3177 | for (unsigned i = 0; i < len; ++i) |
3178 | { |
3179 | if (args[i]) |
3180 | argtypes[i] = unlowered_expr_type (args[i]); |
3181 | else |
3182 | argtypes[i] = NULL_TREE(tree) __null; |
3183 | } |
3184 | |
3185 | switch (code) |
3186 | { |
3187 | /* 4 For every pair T, VQ), where T is an arithmetic or enumeration type, |
3188 | and VQ is either volatile or empty, there exist candidate operator |
3189 | functions of the form |
3190 | VQ T& operator++(VQ T&); */ |
3191 | |
3192 | case POSTINCREMENT_EXPR: |
3193 | case PREINCREMENT_EXPR: |
3194 | case POSTDECREMENT_EXPR: |
3195 | case PREDECREMENT_EXPR: |
3196 | case MODIFY_EXPR: |
3197 | ref1 = 1; |
3198 | break; |
3199 | |
3200 | /* 24There also exist candidate operator functions of the form |
3201 | bool operator!(bool); |
3202 | bool operator&&(bool, bool); |
3203 | bool operator||(bool, bool); */ |
3204 | |
3205 | case TRUTH_NOT_EXPR: |
3206 | build_builtin_candidate |
3207 | (candidates, fnname, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], |
3208 | NULL_TREE(tree) __null, args, argtypes, flags, complain); |
3209 | return; |
3210 | |
3211 | case TRUTH_ORIF_EXPR: |
3212 | case TRUTH_ANDIF_EXPR: |
3213 | build_builtin_candidate |
3214 | (candidates, fnname, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], |
3215 | boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], args, argtypes, flags, complain); |
3216 | return; |
3217 | |
3218 | case ADDR_EXPR: |
3219 | case COMPOUND_EXPR: |
3220 | case COMPONENT_REF: |
3221 | case CO_AWAIT_EXPR: |
3222 | return; |
3223 | |
3224 | case COND_EXPR: |
3225 | case EQ_EXPR: |
3226 | case NE_EXPR: |
3227 | case LT_EXPR: |
3228 | case LE_EXPR: |
3229 | case GT_EXPR: |
3230 | case GE_EXPR: |
3231 | case SPACESHIP_EXPR: |
3232 | enum_p = 1; |
3233 | /* Fall through. */ |
3234 | |
3235 | default: |
3236 | ref1 = 0; |
3237 | } |
3238 | |
3239 | types[0] = make_tree_vector (); |
3240 | types[1] = make_tree_vector (); |
3241 | |
3242 | if (len == 3) |
3243 | len = 2; |
3244 | for (unsigned i = 0; i < len; ++i) |
3245 | { |
3246 | if (MAYBE_CLASS_TYPE_P (argtypes[i])((((enum tree_code) (argtypes[i])->base.code) == TEMPLATE_TYPE_PARM || ((enum tree_code) (argtypes[i])->base.code) == TYPENAME_TYPE || ((enum tree_code) (argtypes[i])->base.code) == TYPEOF_TYPE || ((enum tree_code) (argtypes[i])->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM || ((enum tree_code) (argtypes[i])->base.code) == DECLTYPE_TYPE ) || (((((enum tree_code) (argtypes[i])->base.code)) == RECORD_TYPE || (((enum tree_code) (argtypes[i])->base.code)) == UNION_TYPE ) && ((tree_class_check ((argtypes[i]), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3246, __FUNCTION__))->type_common.lang_flag_5)))) |
3247 | { |
3248 | tree convs; |
3249 | |
3250 | if (i == 0 && code == MODIFY_EXPR && code2 == NOP_EXPR) |
3251 | return; |
3252 | |
3253 | convs = lookup_conversions (argtypes[i]); |
3254 | |
3255 | if (code == COND_EXPR) |
3256 | { |
3257 | if (lvalue_p (args[i])) |
3258 | vec_safe_push (types[i], build_reference_type (argtypes[i])); |
3259 | |
3260 | vec_safe_push (types[i], TYPE_MAIN_VARIANT (argtypes[i])((tree_class_check ((argtypes[i]), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3260, __FUNCTION__))->type_common.main_variant)); |
3261 | } |
3262 | |
3263 | else if (! convs) |
3264 | return; |
3265 | |
3266 | for (; convs; convs = TREE_CHAIN (convs)((contains_struct_check ((convs), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3266, __FUNCTION__))->common.chain)) |
3267 | { |
3268 | type = TREE_TYPE (convs)((contains_struct_check ((convs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3268, __FUNCTION__))->typed.type); |
3269 | |
3270 | if (i == 0 && ref1 |
3271 | && (!TYPE_REF_P (type)(((enum tree_code) (type)->base.code) == REFERENCE_TYPE) |
3272 | || CP_TYPE_CONST_P (TREE_TYPE (type))((cp_type_quals (((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3272, __FUNCTION__))->typed.type)) & TYPE_QUAL_CONST ) != 0))) |
3273 | continue; |
3274 | |
3275 | if (code == COND_EXPR && TYPE_REF_P (type)(((enum tree_code) (type)->base.code) == REFERENCE_TYPE)) |
3276 | vec_safe_push (types[i], type); |
3277 | |
3278 | type = non_reference (type); |
3279 | if (i != 0 || ! ref1) |
3280 | { |
3281 | type = cv_unqualified (type_decays_to (type)); |
3282 | if (enum_p && TREE_CODE (type)((enum tree_code) (type)->base.code) == ENUMERAL_TYPE) |
3283 | vec_safe_push (types[i], type); |
3284 | if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type)((((enum tree_code) (type)->base.code) == ENUMERAL_TYPE && !((tree_check ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3284, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag) ) || (((enum tree_code) (type)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type)->base.code) == INTEGER_TYPE))) |
3285 | type = type_promotes_to (type); |
3286 | } |
3287 | |
3288 | if (! vec_member (type, types[i])) |
3289 | vec_safe_push (types[i], type); |
3290 | } |
3291 | } |
3292 | else |
3293 | { |
3294 | if (code == COND_EXPR && lvalue_p (args[i])) |
3295 | vec_safe_push (types[i], build_reference_type (argtypes[i])); |
3296 | type = non_reference (argtypes[i]); |
3297 | if (i != 0 || ! ref1) |
3298 | { |
3299 | type = cv_unqualified (type_decays_to (type)); |
3300 | if (enum_p && UNSCOPED_ENUM_P (type)(((enum tree_code) (type)->base.code) == ENUMERAL_TYPE && !((tree_check ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3300, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag) )) |
3301 | vec_safe_push (types[i], type); |
3302 | if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type)((((enum tree_code) (type)->base.code) == ENUMERAL_TYPE && !((tree_check ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3302, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag) ) || (((enum tree_code) (type)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type)->base.code) == INTEGER_TYPE))) |
3303 | type = type_promotes_to (type); |
3304 | } |
3305 | vec_safe_push (types[i], type); |
3306 | } |
3307 | } |
3308 | |
3309 | /* Run through the possible parameter types of both arguments, |
3310 | creating candidates with those parameter types. */ |
3311 | FOR_EACH_VEC_ELT_REVERSE (*(types[0]), ix, t)for (ix = (*(types[0])).length () - 1; (*(types[0])).iterate ( (ix), &(t)); (ix)--) |
3312 | { |
3313 | unsigned jx; |
3314 | tree u; |
3315 | |
3316 | if (!types[1]->is_empty ()) |
3317 | FOR_EACH_VEC_ELT_REVERSE (*(types[1]), jx, u)for (jx = (*(types[1])).length () - 1; (*(types[1])).iterate ( (jx), &(u)); (jx)--) |
3318 | add_builtin_candidate |
3319 | (candidates, code, code2, fnname, t, |
3320 | u, args, argtypes, flags, complain); |
3321 | else |
3322 | add_builtin_candidate |
3323 | (candidates, code, code2, fnname, t, |
3324 | NULL_TREE(tree) __null, args, argtypes, flags, complain); |
3325 | } |
3326 | |
3327 | release_tree_vector (types[0]); |
3328 | release_tree_vector (types[1]); |
3329 | } |
3330 | |
3331 | |
3332 | /* If TMPL can be successfully instantiated as indicated by |
3333 | EXPLICIT_TARGS and ARGLIST, adds the instantiation to CANDIDATES. |
3334 | |
3335 | TMPL is the template. EXPLICIT_TARGS are any explicit template |
3336 | arguments. ARGLIST is the arguments provided at the call-site. |
3337 | This does not change ARGLIST. The RETURN_TYPE is the desired type |
3338 | for conversion operators. If OBJ is NULL_TREE, FLAGS and CTYPE are |
3339 | as for add_function_candidate. If an OBJ is supplied, FLAGS and |
3340 | CTYPE are ignored, and OBJ is as for add_conv_candidate. */ |
3341 | |
3342 | static struct z_candidate* |
3343 | add_template_candidate_real (struct z_candidate **candidates, tree tmpl, |
3344 | tree ctype, tree explicit_targs, tree first_arg, |
3345 | const vec<tree, va_gc> *arglist, tree return_type, |
3346 | tree access_path, tree conversion_path, |
3347 | int flags, tree obj, unification_kind_t strict, |
3348 | tsubst_flags_t complain) |
3349 | { |
3350 | int ntparms = DECL_NTPARMS (tmpl)((tree_check ((((tree_check ((((struct tree_template_decl *)( const_cast<union tree_node *> ((((tree_check ((tmpl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3350, __FUNCTION__, (TEMPLATE_DECL))))))))->arguments), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3350, __FUNCTION__, (TREE_LIST)))->list.value)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3350, __FUNCTION__, (TREE_VEC)))->base.u.length); |
3351 | tree targs = make_tree_vec (ntparms); |
3352 | unsigned int len = vec_safe_length (arglist); |
3353 | unsigned int nargs = (first_arg == NULL_TREE(tree) __null ? 0 : 1) + len; |
3354 | unsigned int skip_without_in_chrg = 0; |
3355 | tree first_arg_without_in_chrg = first_arg; |
3356 | tree *args_without_in_chrg; |
3357 | unsigned int nargs_without_in_chrg; |
3358 | unsigned int ia, ix; |
3359 | tree arg; |
3360 | struct z_candidate *cand; |
3361 | tree fn; |
3362 | struct rejection_reason *reason = NULL__null; |
3363 | int errs; |
3364 | conversion **convs = NULL__null; |
3365 | |
3366 | /* We don't do deduction on the in-charge parameter, the VTT |
3367 | parameter or 'this'. */ |
3368 | if (DECL_NONSTATIC_MEMBER_FUNCTION_P (tmpl)(((enum tree_code) (((contains_struct_check ((tmpl), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3368, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE )) |
3369 | { |
3370 | if (first_arg_without_in_chrg != NULL_TREE(tree) __null) |
3371 | first_arg_without_in_chrg = NULL_TREE(tree) __null; |
3372 | else if (return_type && strict == DEDUCE_CALL) |
3373 | /* We're deducing for a call to the result of a template conversion |
3374 | function, so the args don't contain 'this'; leave them alone. */; |
3375 | else |
3376 | ++skip_without_in_chrg; |
3377 | } |
3378 | |
3379 | if ((DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (tmpl)(((contains_struct_check ((tmpl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3379, __FUNCTION__))->decl_minimal.name) == cp_global_trees [CPTI_CTOR_IDENTIFIER]) |
3380 | || DECL_BASE_CONSTRUCTOR_P (tmpl)(((contains_struct_check ((tmpl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3380, __FUNCTION__))->decl_minimal.name) == cp_global_trees [CPTI_BASE_CTOR_IDENTIFIER])) |
3381 | && CLASSTYPE_VBASECLASSES (DECL_CONTEXT (tmpl))((((tree_class_check ((((contains_struct_check ((tmpl), (TS_DECL_MINIMAL ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3381, __FUNCTION__))->decl_minimal.context)), (tcc_type) , "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3381, __FUNCTION__))->type_with_lang_specific.lang_specific ))->vbases)) |
3382 | { |
3383 | if (first_arg_without_in_chrg != NULL_TREE(tree) __null) |
3384 | first_arg_without_in_chrg = NULL_TREE(tree) __null; |
3385 | else |
3386 | ++skip_without_in_chrg; |
3387 | } |
3388 | |
3389 | if (len < skip_without_in_chrg) |
3390 | return NULL__null; |
3391 | |
3392 | if (DECL_CONSTRUCTOR_P (tmpl)((tree_check (((((enum tree_code) (tmpl)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((tmpl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3392, __FUNCTION__, (TEMPLATE_DECL))))))))->result : tmpl )), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3392, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor ) && nargs == 2 |
3393 | && same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (first_arg)((contains_struct_check ((first_arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3393, __FUNCTION__))->typed.type), |
3394 | TREE_TYPE ((*arglist)[0])((contains_struct_check (((*arglist)[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3394, __FUNCTION__))->typed.type))) |
3395 | { |
3396 | /* 12.8/6 says, "A declaration of a constructor for a class X is |
3397 | ill-formed if its first parameter is of type (optionally cv-qualified) |
3398 | X and either there are no other parameters or else all other |
3399 | parameters have default arguments. A member function template is never |
3400 | instantiated to produce such a constructor signature." |
3401 | |
3402 | So if we're trying to copy an object of the containing class, don't |
3403 | consider a template constructor that has a first parameter type that |
3404 | is just a template parameter, as we would deduce a signature that we |
3405 | would then reject in the code below. */ |
3406 | if (tree firstparm = FUNCTION_FIRST_USER_PARMTYPE (tmpl)skip_artificial_parms_for ((tmpl), ((tree_check2 ((((contains_struct_check ((tmpl), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3406, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3406, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values))) |
3407 | { |
3408 | firstparm = TREE_VALUE (firstparm)((tree_check ((firstparm), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3408, __FUNCTION__, (TREE_LIST)))->list.value); |
3409 | if (PACK_EXPANSION_P (firstparm)(((enum tree_code) (firstparm)->base.code) == TYPE_PACK_EXPANSION || ((enum tree_code) (firstparm)->base.code) == EXPR_PACK_EXPANSION )) |
3410 | firstparm = PACK_EXPANSION_PATTERN (firstparm)(((enum tree_code) (firstparm)->base.code) == TYPE_PACK_EXPANSION ? ((contains_struct_check ((firstparm), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3410, __FUNCTION__))->typed.type) : (*((const_cast<tree *> (tree_operand_check ((firstparm), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3410, __FUNCTION__)))))); |
3411 | if (TREE_CODE (firstparm)((enum tree_code) (firstparm)->base.code) == TEMPLATE_TYPE_PARM) |
3412 | { |
3413 | gcc_assert (!explicit_targs)((void)(!(!explicit_targs) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3413, __FUNCTION__), 0 : 0)); |
3414 | reason = invalid_copy_with_fn_template_rejection (); |
3415 | goto fail; |
3416 | } |
3417 | } |
3418 | } |
3419 | |
3420 | nargs_without_in_chrg = ((first_arg_without_in_chrg != NULL_TREE(tree) __null ? 1 : 0) |
3421 | + (len - skip_without_in_chrg)); |
3422 | args_without_in_chrg = XALLOCAVEC (tree, nargs_without_in_chrg)((tree *) __builtin_alloca(sizeof (tree) * (nargs_without_in_chrg ))); |
3423 | ia = 0; |
3424 | if (first_arg_without_in_chrg != NULL_TREE(tree) __null) |
3425 | { |
3426 | args_without_in_chrg[ia] = first_arg_without_in_chrg; |
3427 | ++ia; |
3428 | } |
3429 | for (ix = skip_without_in_chrg; |
3430 | vec_safe_iterate (arglist, ix, &arg); |
3431 | ++ix) |
3432 | { |
3433 | args_without_in_chrg[ia] = arg; |
3434 | ++ia; |
3435 | } |
3436 | gcc_assert (ia == nargs_without_in_chrg)((void)(!(ia == nargs_without_in_chrg) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3436, __FUNCTION__), 0 : 0)); |
3437 | |
3438 | errs = errorcount(global_dc)->diagnostic_count[(int) (DK_ERROR)]+sorrycount(global_dc)->diagnostic_count[(int) (DK_SORRY)]; |
3439 | if (!obj) |
3440 | convs = alloc_conversions (nargs); |
3441 | fn = fn_type_unification (tmpl, explicit_targs, targs, |
3442 | args_without_in_chrg, |
3443 | nargs_without_in_chrg, |
3444 | return_type, strict, flags, convs, |
3445 | false, complain & tf_decltype); |
3446 | |
3447 | if (fn == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
3448 | { |
3449 | /* Don't repeat unification later if it already resulted in errors. */ |
3450 | if (errorcount(global_dc)->diagnostic_count[(int) (DK_ERROR)]+sorrycount(global_dc)->diagnostic_count[(int) (DK_SORRY)] == errs) |
3451 | reason = template_unification_rejection (tmpl, explicit_targs, |
3452 | targs, args_without_in_chrg, |
3453 | nargs_without_in_chrg, |
3454 | return_type, strict, flags); |
3455 | else |
3456 | reason = template_unification_error_rejection (); |
3457 | goto fail; |
3458 | } |
3459 | |
3460 | /* Now the explicit specifier might have been deduced; check if this |
3461 | declaration is explicit. If it is and we're ignoring non-converting |
3462 | constructors, don't add this function to the set of candidates. */ |
3463 | if ((flags & LOOKUP_ONLYCONVERTING(1 << 2)) && DECL_NONCONVERTING_P (fn)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? ( (struct tree_template_decl *)(const_cast<union tree_node * > ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3463, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn) ), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3463, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) (fn)->base.code) == FUNCTION_DECL || ((( enum tree_code) (fn)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3463, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3463, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3463, __FUNCTION__); <->u.fn; })->nonconverting )) |
3464 | return NULL__null; |
3465 | |
3466 | if (DECL_CONSTRUCTOR_P (fn)((tree_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3466, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn) ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3466, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor ) && nargs == 2) |
3467 | { |
3468 | tree arg_types = FUNCTION_FIRST_USER_PARMTYPE (fn)skip_artificial_parms_for ((fn), ((tree_check2 ((((contains_struct_check ((fn), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3468, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3468, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values)); |
3469 | if (arg_types && same_type_p (TYPE_MAIN_VARIANT (TREE_VALUE (arg_types)),comptypes ((((tree_class_check ((((tree_check ((arg_types), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3469, __FUNCTION__, (TREE_LIST)))->list.value)), (tcc_type ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3469, __FUNCTION__))->type_common.main_variant)), (ctype ), 0) |
3470 | ctype)comptypes ((((tree_class_check ((((tree_check ((arg_types), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3469, __FUNCTION__, (TREE_LIST)))->list.value)), (tcc_type ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3469, __FUNCTION__))->type_common.main_variant)), (ctype ), 0)) |
3471 | { |
3472 | /* We're trying to produce a constructor with a prohibited signature, |
3473 | as discussed above; handle here any cases we didn't catch then, |
3474 | such as X(X<T>). */ |
3475 | reason = invalid_copy_with_fn_template_rejection (); |
3476 | goto fail; |
3477 | } |
3478 | } |
3479 | |
3480 | if (obj != NULL_TREE(tree) __null) |
3481 | /* Aha, this is a conversion function. */ |
3482 | cand = add_conv_candidate (candidates, fn, obj, arglist, |
3483 | access_path, conversion_path, complain); |
3484 | else |
3485 | cand = add_function_candidate (candidates, fn, ctype, |
3486 | first_arg, arglist, access_path, |
3487 | conversion_path, flags, convs, complain); |
3488 | if (DECL_TI_TEMPLATE (fn)((struct tree_template_info*)(tree_check (((((contains_struct_check ((template_info_decl_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3488, __FUNCTION__)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3488, __FUNCTION__))->decl_common.lang_specific) ->u. min.template_info)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3488, __FUNCTION__, (TEMPLATE_INFO))))->tmpl != tmpl) |
3489 | /* This situation can occur if a member template of a template |
3490 | class is specialized. Then, instantiate_template might return |
3491 | an instantiation of the specialization, in which case the |
3492 | DECL_TI_TEMPLATE field will point at the original |
3493 | specialization. For example: |
3494 | |
3495 | template <class T> struct S { template <class U> void f(U); |
3496 | template <> void f(int) {}; }; |
3497 | S<double> sd; |
3498 | sd.f(3); |
3499 | |
3500 | Here, TMPL will be template <class U> S<double>::f(U). |
3501 | And, instantiate template will give us the specialization |
3502 | template <> S<double>::f(int). But, the DECL_TI_TEMPLATE field |
3503 | for this will point at template <class T> template <> S<T>::f(int), |
3504 | so that we can find the definition. For the purposes of |
3505 | overload resolution, however, we want the original TMPL. */ |
3506 | cand->template_decl = build_template_info (tmpl, targs); |
3507 | else |
3508 | cand->template_decl = DECL_TEMPLATE_INFO (fn)(((contains_struct_check ((template_info_decl_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3508, __FUNCTION__)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3508, __FUNCTION__))->decl_common.lang_specific) ->u. min.template_info); |
3509 | cand->explicit_targs = explicit_targs; |
3510 | |
3511 | return cand; |
3512 | fail: |
3513 | return add_candidate (candidates, tmpl, first_arg, arglist, nargs, NULL__null, |
3514 | access_path, conversion_path, 0, reason, flags); |
3515 | } |
3516 | |
3517 | |
3518 | static struct z_candidate * |
3519 | add_template_candidate (struct z_candidate **candidates, tree tmpl, tree ctype, |
3520 | tree explicit_targs, tree first_arg, |
3521 | const vec<tree, va_gc> *arglist, tree return_type, |
3522 | tree access_path, tree conversion_path, int flags, |
3523 | unification_kind_t strict, tsubst_flags_t complain) |
3524 | { |
3525 | return |
3526 | add_template_candidate_real (candidates, tmpl, ctype, |
3527 | explicit_targs, first_arg, arglist, |
3528 | return_type, access_path, conversion_path, |
3529 | flags, NULL_TREE(tree) __null, strict, complain); |
3530 | } |
3531 | |
3532 | /* Create an overload candidate for the conversion function template TMPL, |
3533 | returning RETURN_TYPE, which will be invoked for expression OBJ to produce a |
3534 | pointer-to-function which will in turn be called with the argument list |
3535 | ARGLIST, and add it to CANDIDATES. This does not change ARGLIST. FLAGS is |
3536 | passed on to implicit_conversion. */ |
3537 | |
3538 | static struct z_candidate * |
3539 | add_template_conv_candidate (struct z_candidate **candidates, tree tmpl, |
3540 | tree obj, |
3541 | const vec<tree, va_gc> *arglist, |
3542 | tree return_type, tree access_path, |
3543 | tree conversion_path, tsubst_flags_t complain) |
3544 | { |
3545 | /* Making this work broke PR 71117 and 85118, so until the committee resolves |
3546 | core issue 2189, let's disable this candidate if there are any call |
3547 | operators. */ |
3548 | if (*candidates) |
3549 | return NULL__null; |
3550 | |
3551 | return |
3552 | add_template_candidate_real (candidates, tmpl, NULL_TREE(tree) __null, NULL_TREE(tree) __null, |
3553 | NULL_TREE(tree) __null, arglist, return_type, access_path, |
3554 | conversion_path, 0, obj, DEDUCE_CALL, |
3555 | complain); |
3556 | } |
3557 | |
3558 | /* The CANDS are the set of candidates that were considered for |
3559 | overload resolution. Return the set of viable candidates, or CANDS |
3560 | if none are viable. If any of the candidates were viable, set |
3561 | *ANY_VIABLE_P to true. STRICT_P is true if a candidate should be |
3562 | considered viable only if it is strictly viable. */ |
3563 | |
3564 | static struct z_candidate* |
3565 | splice_viable (struct z_candidate *cands, |
3566 | bool strict_p, |
3567 | bool *any_viable_p) |
3568 | { |
3569 | struct z_candidate *viable; |
3570 | struct z_candidate **last_viable; |
3571 | struct z_candidate **cand; |
3572 | bool found_strictly_viable = false; |
3573 | |
3574 | /* Be strict inside templates, since build_over_call won't actually |
3575 | do the conversions to get pedwarns. */ |
3576 | if (processing_template_declscope_chain->x_processing_template_decl) |
3577 | strict_p = true; |
3578 | |
3579 | viable = NULL__null; |
3580 | last_viable = &viable; |
3581 | *any_viable_p = false; |
3582 | |
3583 | cand = &cands; |
3584 | while (*cand) |
3585 | { |
3586 | struct z_candidate *c = *cand; |
3587 | if (!strict_p |
3588 | && (c->viable == 1 || TREE_CODE (c->fn)((enum tree_code) (c->fn)->base.code) == TEMPLATE_DECL)) |
3589 | { |
3590 | /* Be strict in the presence of a viable candidate. Also if |
3591 | there are template candidates, so that we get deduction errors |
3592 | for them instead of silently preferring a bad conversion. */ |
3593 | strict_p = true; |
3594 | if (viable && !found_strictly_viable) |
3595 | { |
3596 | /* Put any spliced near matches back onto the main list so |
3597 | that we see them if there is no strict match. */ |
3598 | *any_viable_p = false; |
3599 | *last_viable = cands; |
3600 | cands = viable; |
3601 | viable = NULL__null; |
3602 | last_viable = &viable; |
3603 | } |
3604 | } |
3605 | |
3606 | if (strict_p ? c->viable == 1 : c->viable) |
3607 | { |
3608 | *last_viable = c; |
3609 | *cand = c->next; |
3610 | c->next = NULL__null; |
3611 | last_viable = &c->next; |
3612 | *any_viable_p = true; |
3613 | if (c->viable == 1) |
3614 | found_strictly_viable = true; |
3615 | } |
3616 | else |
3617 | cand = &c->next; |
3618 | } |
3619 | |
3620 | return viable ? viable : cands; |
3621 | } |
3622 | |
3623 | static bool |
3624 | any_strictly_viable (struct z_candidate *cands) |
3625 | { |
3626 | for (; cands; cands = cands->next) |
3627 | if (cands->viable == 1) |
3628 | return true; |
3629 | return false; |
3630 | } |
3631 | |
3632 | /* OBJ is being used in an expression like "OBJ.f (...)". In other |
3633 | words, it is about to become the "this" pointer for a member |
3634 | function call. Take the address of the object. */ |
3635 | |
3636 | static tree |
3637 | build_this (tree obj) |
3638 | { |
3639 | /* In a template, we are only concerned about the type of the |
3640 | expression, so we can take a shortcut. */ |
3641 | if (processing_template_declscope_chain->x_processing_template_decl) |
3642 | return build_address (obj); |
3643 | |
3644 | return cp_build_addr_expr (obj, tf_warning_or_error); |
3645 | } |
3646 | |
3647 | /* Returns true iff functions are equivalent. Equivalent functions are |
3648 | not '==' only if one is a function-local extern function or if |
3649 | both are extern "C". */ |
3650 | |
3651 | static inline int |
3652 | equal_functions (tree fn1, tree fn2) |
3653 | { |
3654 | if (TREE_CODE (fn1)((enum tree_code) (fn1)->base.code) != TREE_CODE (fn2)((enum tree_code) (fn2)->base.code)) |
3655 | return 0; |
3656 | if (TREE_CODE (fn1)((enum tree_code) (fn1)->base.code) == TEMPLATE_DECL) |
3657 | return fn1 == fn2; |
3658 | if (DECL_LOCAL_DECL_P (fn1)((contains_struct_check (((tree_check2 ((fn1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3658, __FUNCTION__, (VAR_DECL), (FUNCTION_DECL)))), (TS_DECL_COMMON ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3658, __FUNCTION__))->decl_common.lang_flag_0) || DECL_LOCAL_DECL_P (fn2)((contains_struct_check (((tree_check2 ((fn2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3658, __FUNCTION__, (VAR_DECL), (FUNCTION_DECL)))), (TS_DECL_COMMON ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3658, __FUNCTION__))->decl_common.lang_flag_0) |
3659 | || DECL_EXTERN_C_FUNCTION_P (fn1)((((enum tree_code) (fn1)->base.code) == FUNCTION_DECL && !(((enum tree_code) (fn1)->base.code) == FUNCTION_DECL && ((contains_struct_check ((fn1), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3659, __FUNCTION__))->decl_common.lang_specific) && __extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (fn1)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3659, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn1 )), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3659, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) (fn1)->base.code) == FUNCTION_DECL || (( (enum tree_code) (fn1)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3659, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn1) , "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3659, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3659, __FUNCTION__); <->u.fn; })->thunk_p)) && ((((contains_struct_check ((fn1), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3659, __FUNCTION__))->decl_common.lang_specific) ? ((contains_struct_check ((fn1), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3659, __FUNCTION__))->decl_common.lang_specific)->u.base .language : (((enum tree_code) (fn1)->base.code) == FUNCTION_DECL ? lang_c : lang_cplusplus)) == lang_c))) |
3660 | return decls_match (fn1, fn2); |
3661 | return fn1 == fn2; |
3662 | } |
3663 | |
3664 | /* Print information about a candidate FN being rejected due to INFO. */ |
3665 | |
3666 | static void |
3667 | print_conversion_rejection (location_t loc, struct conversion_info *info, |
3668 | tree fn) |
3669 | { |
3670 | tree from = info->from; |
3671 | if (!TYPE_P (from)(tree_code_type[(int) (((enum tree_code) (from)->base.code ))] == tcc_type)) |
3672 | from = lvalue_type (from); |
3673 | if (info->n_arg == -1) |
3674 | { |
3675 | /* Conversion of implicit `this' argument failed. */ |
3676 | if (!TYPE_P (info->from)(tree_code_type[(int) (((enum tree_code) (info->from)-> base.code))] == tcc_type)) |
3677 | /* A bad conversion for 'this' must be discarding cv-quals. */ |
3678 | inform (loc, " passing %qT as %<this%> " |
3679 | "argument discards qualifiers", |
3680 | from); |
3681 | else |
3682 | inform (loc, " no known conversion for implicit " |
3683 | "%<this%> parameter from %qH to %qI", |
3684 | from, info->to_type); |
3685 | } |
3686 | else if (!TYPE_P (info->from)(tree_code_type[(int) (((enum tree_code) (info->from)-> base.code))] == tcc_type)) |
3687 | { |
3688 | if (info->n_arg >= 0) |
3689 | inform (loc, " conversion of argument %d would be ill-formed:", |
3690 | info->n_arg + 1); |
3691 | perform_implicit_conversion (info->to_type, info->from, |
3692 | tf_warning_or_error); |
3693 | } |
3694 | else if (info->n_arg == -2) |
3695 | /* Conversion of conversion function return value failed. */ |
3696 | inform (loc, " no known conversion from %qH to %qI", |
3697 | from, info->to_type); |
3698 | else |
3699 | { |
3700 | if (TREE_CODE (fn)((enum tree_code) (fn)->base.code) == FUNCTION_DECL) |
3701 | loc = get_fndecl_argument_location (fn, info->n_arg); |
3702 | inform (loc, " no known conversion for argument %d from %qH to %qI", |
3703 | info->n_arg + 1, from, info->to_type); |
3704 | } |
3705 | } |
3706 | |
3707 | /* Print information about a candidate with WANT parameters and we found |
3708 | HAVE. */ |
3709 | |
3710 | static void |
3711 | print_arity_information (location_t loc, unsigned int have, unsigned int want) |
3712 | { |
3713 | inform_n (loc, want, |
3714 | " candidate expects %d argument, %d provided", |
3715 | " candidate expects %d arguments, %d provided", |
3716 | want, have); |
3717 | } |
3718 | |
3719 | /* Print information about one overload candidate CANDIDATE. MSGSTR |
3720 | is the text to print before the candidate itself. |
3721 | |
3722 | NOTE: Unlike most diagnostic functions in GCC, MSGSTR is expected |
3723 | to have been run through gettext by the caller. This wart makes |
3724 | life simpler in print_z_candidates and for the translators. */ |
3725 | |
3726 | static void |
3727 | print_z_candidate (location_t loc, const char *msgstr, |
3728 | struct z_candidate *candidate) |
3729 | { |
3730 | const char *msg = (msgstr == NULL__null |
3731 | ? "" |
3732 | : ACONCAT ((_(msgstr), " ", NULL))(libiberty_concat_ptr = (char *) __builtin_alloca(concat_length (gettext (msgstr), " ", __null) + 1), concat_copy2 (gettext ( msgstr), " ", __null))); |
3733 | tree fn = candidate->fn; |
3734 | if (flag_new_inheriting_ctorsglobal_options.x_flag_new_inheriting_ctors) |
3735 | fn = strip_inheriting_ctors (fn); |
3736 | location_t cloc = location_of (fn); |
3737 | |
3738 | if (identifier_p (fn)) |
3739 | { |
3740 | cloc = loc; |
3741 | if (candidate->num_convs == 3) |
3742 | inform (cloc, "%s%<%D(%T, %T, %T)%> (built-in)", msg, fn, |
3743 | candidate->convs[0]->type, |
3744 | candidate->convs[1]->type, |
3745 | candidate->convs[2]->type); |
3746 | else if (candidate->num_convs == 2) |
3747 | inform (cloc, "%s%<%D(%T, %T)%> (built-in)", msg, fn, |
3748 | candidate->convs[0]->type, |
3749 | candidate->convs[1]->type); |
3750 | else |
3751 | inform (cloc, "%s%<%D(%T)%> (built-in)", msg, fn, |
3752 | candidate->convs[0]->type); |
3753 | } |
3754 | else if (TYPE_P (fn)(tree_code_type[(int) (((enum tree_code) (fn)->base.code)) ] == tcc_type)) |
3755 | inform (cloc, "%s%qT (conversion)", msg, fn); |
3756 | else if (candidate->viable == -1) |
3757 | inform (cloc, "%s%#qD (near match)", msg, fn); |
3758 | else if (DECL_DELETED_FN (fn)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? ( (struct tree_template_decl *)(const_cast<union tree_node * > ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3758, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn) ), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3758, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) (fn)->base.code) == FUNCTION_DECL || ((( enum tree_code) (fn)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3758, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3758, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3758, __FUNCTION__); <->u.fn; })->min.base.threadprivate_or_deleted_p )) |
3759 | inform (cloc, "%s%#qD (deleted)", msg, fn); |
3760 | else if (candidate->reversed ()) |
3761 | inform (cloc, "%s%#qD (reversed)", msg, fn); |
3762 | else if (candidate->rewritten ()) |
3763 | inform (cloc, "%s%#qD (rewritten)", msg, fn); |
3764 | else |
3765 | inform (cloc, "%s%#qD", msg, fn); |
3766 | if (fn != candidate->fn) |
3767 | { |
3768 | cloc = location_of (candidate->fn); |
3769 | inform (cloc, " inherited here"); |
3770 | } |
3771 | /* Give the user some information about why this candidate failed. */ |
3772 | if (candidate->reason != NULL__null) |
3773 | { |
3774 | struct rejection_reason *r = candidate->reason; |
3775 | |
3776 | switch (r->code) |
3777 | { |
3778 | case rr_arity: |
3779 | print_arity_information (cloc, r->u.arity.actual, |
3780 | r->u.arity.expected); |
3781 | break; |
3782 | case rr_arg_conversion: |
3783 | print_conversion_rejection (cloc, &r->u.conversion, fn); |
3784 | break; |
3785 | case rr_bad_arg_conversion: |
3786 | print_conversion_rejection (cloc, &r->u.bad_conversion, fn); |
3787 | break; |
3788 | case rr_explicit_conversion: |
3789 | inform (cloc, " return type %qT of explicit conversion function " |
3790 | "cannot be converted to %qT with a qualification " |
3791 | "conversion", r->u.conversion.from, |
3792 | r->u.conversion.to_type); |
3793 | break; |
3794 | case rr_template_conversion: |
3795 | inform (cloc, " conversion from return type %qT of template " |
3796 | "conversion function specialization to %qT is not an " |
3797 | "exact match", r->u.conversion.from, |
3798 | r->u.conversion.to_type); |
3799 | break; |
3800 | case rr_template_unification: |
3801 | /* We use template_unification_error_rejection if unification caused |
3802 | actual non-SFINAE errors, in which case we don't need to repeat |
3803 | them here. */ |
3804 | if (r->u.template_unification.tmpl == NULL_TREE(tree) __null) |
3805 | { |
3806 | inform (cloc, " substitution of deduced template arguments " |
3807 | "resulted in errors seen above"); |
3808 | break; |
3809 | } |
3810 | /* Re-run template unification with diagnostics. */ |
3811 | inform (cloc, " template argument deduction/substitution failed:"); |
3812 | fn_type_unification (r->u.template_unification.tmpl, |
3813 | r->u.template_unification.explicit_targs, |
3814 | (make_tree_vec |
3815 | (r->u.template_unification.num_targs)), |
3816 | r->u.template_unification.args, |
3817 | r->u.template_unification.nargs, |
3818 | r->u.template_unification.return_type, |
3819 | r->u.template_unification.strict, |
3820 | r->u.template_unification.flags, |
3821 | NULL__null, true, false); |
3822 | break; |
3823 | case rr_invalid_copy: |
3824 | inform (cloc, |
3825 | " a constructor taking a single argument of its own " |
3826 | "class type is invalid"); |
3827 | break; |
3828 | case rr_constraint_failure: |
3829 | diagnose_constraints (cloc, fn, NULL_TREE(tree) __null); |
3830 | break; |
3831 | case rr_inherited_ctor: |
3832 | inform (cloc, " an inherited constructor is not a candidate for " |
3833 | "initialization from an expression of the same or derived " |
3834 | "type"); |
3835 | break; |
3836 | case rr_none: |
3837 | default: |
3838 | /* This candidate didn't have any issues or we failed to |
3839 | handle a particular code. Either way... */ |
3840 | gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3840, __FUNCTION__)); |
3841 | } |
3842 | } |
3843 | } |
3844 | |
3845 | static void |
3846 | print_z_candidates (location_t loc, struct z_candidate *candidates) |
3847 | { |
3848 | struct z_candidate *cand1; |
3849 | struct z_candidate **cand2; |
3850 | |
3851 | if (!candidates) |
3852 | return; |
3853 | |
3854 | /* Remove non-viable deleted candidates. */ |
3855 | cand1 = candidates; |
3856 | for (cand2 = &cand1; *cand2; ) |
3857 | { |
3858 | if (TREE_CODE ((*cand2)->fn)((enum tree_code) ((*cand2)->fn)->base.code) == FUNCTION_DECL |
3859 | && !(*cand2)->viable |
3860 | && DECL_DELETED_FN ((*cand2)->fn)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) ((*cand2)->fn)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check (((*cand2)->fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3860, __FUNCTION__, (TEMPLATE_DECL))))))))->result : (*cand2 )->fn)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3860, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) ((*cand2)->fn)->base.code) == FUNCTION_DECL || (((enum tree_code) ((*cand2)->fn)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check (((*cand2)->fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3860, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check (((*cand2 )->fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3860, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3860, __FUNCTION__); <->u.fn; })->min.base.threadprivate_or_deleted_p )) |
3861 | *cand2 = (*cand2)->next; |
3862 | else |
3863 | cand2 = &(*cand2)->next; |
3864 | } |
3865 | /* ...if there are any non-deleted ones. */ |
3866 | if (cand1) |
3867 | candidates = cand1; |
3868 | |
3869 | /* There may be duplicates in the set of candidates. We put off |
3870 | checking this condition as long as possible, since we have no way |
3871 | to eliminate duplicates from a set of functions in less than n^2 |
3872 | time. Now we are about to emit an error message, so it is more |
3873 | permissible to go slowly. */ |
3874 | for (cand1 = candidates; cand1; cand1 = cand1->next) |
3875 | { |
3876 | tree fn = cand1->fn; |
3877 | /* Skip builtin candidates and conversion functions. */ |
3878 | if (!DECL_P (fn)(tree_code_type[(int) (((enum tree_code) (fn)->base.code)) ] == tcc_declaration)) |
3879 | continue; |
3880 | cand2 = &cand1->next; |
3881 | while (*cand2) |
3882 | { |
3883 | if (DECL_P ((*cand2)->fn)(tree_code_type[(int) (((enum tree_code) ((*cand2)->fn)-> base.code))] == tcc_declaration) |
3884 | && equal_functions (fn, (*cand2)->fn)) |
3885 | *cand2 = (*cand2)->next; |
3886 | else |
3887 | cand2 = &(*cand2)->next; |
3888 | } |
3889 | } |
3890 | |
3891 | for (; candidates; candidates = candidates->next) |
3892 | print_z_candidate (loc, N_("candidate:")"candidate:", candidates); |
3893 | } |
3894 | |
3895 | /* USER_SEQ is a user-defined conversion sequence, beginning with a |
3896 | USER_CONV. STD_SEQ is the standard conversion sequence applied to |
3897 | the result of the conversion function to convert it to the final |
3898 | desired type. Merge the two sequences into a single sequence, |
3899 | and return the merged sequence. */ |
3900 | |
3901 | static conversion * |
3902 | merge_conversion_sequences (conversion *user_seq, conversion *std_seq) |
3903 | { |
3904 | conversion **t; |
3905 | bool bad = user_seq->bad_p; |
3906 | |
3907 | gcc_assert (user_seq->kind == ck_user)((void)(!(user_seq->kind == ck_user) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3907, __FUNCTION__), 0 : 0)); |
3908 | |
3909 | /* Find the end of the second conversion sequence. */ |
3910 | for (t = &std_seq; (*t)->kind != ck_identity; t = &((*t)->u.next)) |
3911 | { |
3912 | /* The entire sequence is a user-conversion sequence. */ |
3913 | (*t)->user_conv_p = true; |
3914 | if (bad) |
3915 | (*t)->bad_p = true; |
3916 | } |
3917 | |
3918 | if ((*t)->rvaluedness_matches_p) |
3919 | /* We're binding a reference directly to the result of the conversion. |
3920 | build_user_type_conversion_1 stripped the REFERENCE_TYPE from the return |
3921 | type, but we want it back. */ |
3922 | user_seq->type = TREE_TYPE (TREE_TYPE (user_seq->cand->fn))((contains_struct_check ((((contains_struct_check ((user_seq-> cand->fn), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3922, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3922, __FUNCTION__))->typed.type); |
3923 | |
3924 | /* Replace the identity conversion with the user conversion |
3925 | sequence. */ |
3926 | *t = user_seq; |
3927 | |
3928 | return std_seq; |
3929 | } |
3930 | |
3931 | /* Handle overload resolution for initializing an object of class type from |
3932 | an initializer list. First we look for a suitable constructor that |
3933 | takes a std::initializer_list; if we don't find one, we then look for a |
3934 | non-list constructor. |
3935 | |
3936 | Parameters are as for add_candidates, except that the arguments are in |
3937 | the form of a CONSTRUCTOR (the initializer list) rather than a vector, and |
3938 | the RETURN_TYPE parameter is replaced by TOTYPE, the desired type. */ |
3939 | |
3940 | static void |
3941 | add_list_candidates (tree fns, tree first_arg, |
3942 | const vec<tree, va_gc> *args, tree totype, |
3943 | tree explicit_targs, bool template_only, |
3944 | tree conversion_path, tree access_path, |
3945 | int flags, |
3946 | struct z_candidate **candidates, |
3947 | tsubst_flags_t complain) |
3948 | { |
3949 | gcc_assert (*candidates == NULL)((void)(!(*candidates == __null) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3949, __FUNCTION__), 0 : 0)); |
3950 | |
3951 | /* We're looking for a ctor for list-initialization. */ |
3952 | flags |= LOOKUP_LIST_INIT_CTOR((((1 << 6) << 1) << 1) << 1); |
3953 | /* And we don't allow narrowing conversions. We also use this flag to |
3954 | avoid the copy constructor call for copy-list-initialization. */ |
3955 | flags |= LOOKUP_NO_NARROWING(((1 << 6) << 1) << 1); |
3956 | |
3957 | unsigned nart = num_artificial_parms_for (OVL_FIRST (fns)ovl_first (fns)) - 1; |
3958 | tree init_list = (*args)[nart]; |
3959 | |
3960 | /* Always use the default constructor if the list is empty (DR 990). */ |
3961 | if (CONSTRUCTOR_NELTS (init_list)(vec_safe_length (((tree_check ((init_list), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3961, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))) == 0 |
3962 | && TYPE_HAS_DEFAULT_CONSTRUCTOR (totype)((((tree_class_check ((totype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3962, __FUNCTION__))->type_with_lang_specific.lang_specific ))->has_default_ctor)) |
3963 | ; |
3964 | /* If the class has a list ctor, try passing the list as a single |
3965 | argument first, but only consider list ctors. */ |
3966 | else if (TYPE_HAS_LIST_CTOR (totype)((((tree_class_check ((totype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3966, __FUNCTION__))->type_with_lang_specific.lang_specific ))->has_list_ctor)) |
3967 | { |
3968 | flags |= LOOKUP_LIST_ONLY((((((1 << 6) << 1) << 1) << 1) << 1) << 1); |
3969 | add_candidates (fns, first_arg, args, NULL_TREE(tree) __null, |
3970 | explicit_targs, template_only, conversion_path, |
3971 | access_path, flags, candidates, complain); |
3972 | if (any_strictly_viable (*candidates)) |
3973 | return; |
3974 | } |
3975 | else if (CONSTRUCTOR_IS_DESIGNATED_INIT (init_list)(((tree_not_check2 (((tree_check ((init_list), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3975, __FUNCTION__, (CONSTRUCTOR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3975, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_6)) |
3976 | && !CP_AGGREGATE_TYPE_P (totype)(gnu_vector_type_p (totype) || ((enum tree_code) (totype)-> base.code) == ARRAY_TYPE || ((((((enum tree_code) (totype)-> base.code)) == RECORD_TYPE || (((enum tree_code) (totype)-> base.code)) == UNION_TYPE) && ((tree_class_check ((totype ), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3976, __FUNCTION__))->type_common.lang_flag_5)) && (((tree_class_check ((totype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3976, __FUNCTION__))->type_common.size) != (tree) __null ) && !((((tree_class_check ((totype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3976, __FUNCTION__))->type_with_lang_specific.lang_specific ))->non_aggregate)))) |
3977 | { |
3978 | if (complain & tf_error) |
3979 | error ("designated initializers cannot be used with a " |
3980 | "non-aggregate type %qT", totype); |
3981 | return; |
3982 | } |
3983 | |
3984 | /* Expand the CONSTRUCTOR into a new argument vec. */ |
3985 | vec<tree, va_gc> *new_args; |
3986 | vec_alloc (new_args, nart + CONSTRUCTOR_NELTS (init_list)(vec_safe_length (((tree_check ((init_list), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3986, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))); |
3987 | for (unsigned i = 0; i < nart; ++i) |
3988 | new_args->quick_push ((*args)[i]); |
3989 | for (unsigned i = 0; i < CONSTRUCTOR_NELTS (init_list)(vec_safe_length (((tree_check ((init_list), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3989, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))); ++i) |
3990 | new_args->quick_push (CONSTRUCTOR_ELT (init_list, i)(&(*((tree_check ((init_list), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 3990, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[ i])->value); |
3991 | |
3992 | /* We aren't looking for list-ctors anymore. */ |
3993 | flags &= ~LOOKUP_LIST_ONLY((((((1 << 6) << 1) << 1) << 1) << 1) << 1); |
3994 | /* We allow more user-defined conversions within an init-list. */ |
3995 | flags &= ~LOOKUP_NO_CONVERSION(1 << 4); |
3996 | |
3997 | add_candidates (fns, first_arg, new_args, NULL_TREE(tree) __null, |
3998 | explicit_targs, template_only, conversion_path, |
3999 | access_path, flags, candidates, complain); |
4000 | } |
4001 | |
4002 | /* Returns the best overload candidate to perform the requested |
4003 | conversion. This function is used for three the overloading situations |
4004 | described in [over.match.copy], [over.match.conv], and [over.match.ref]. |
4005 | If TOTYPE is a REFERENCE_TYPE, we're trying to find a direct binding as |
4006 | per [dcl.init.ref], so we ignore temporary bindings. */ |
4007 | |
4008 | static struct z_candidate * |
4009 | build_user_type_conversion_1 (tree totype, tree expr, int flags, |
4010 | tsubst_flags_t complain) |
4011 | { |
4012 | struct z_candidate *candidates, *cand; |
4013 | tree fromtype; |
4014 | tree ctors = NULL_TREE(tree) __null; |
4015 | tree conv_fns = NULL_TREE(tree) __null; |
4016 | conversion *conv = NULL__null; |
4017 | tree first_arg = NULL_TREE(tree) __null; |
4018 | vec<tree, va_gc> *args = NULL__null; |
4019 | bool any_viable_p; |
4020 | int convflags; |
4021 | |
4022 | if (!expr) |
4023 | return NULL__null; |
4024 | |
4025 | fromtype = TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4025, __FUNCTION__))->typed.type); |
4026 | |
4027 | /* We represent conversion within a hierarchy using RVALUE_CONV and |
4028 | BASE_CONV, as specified by [over.best.ics]; these become plain |
4029 | constructor calls, as specified in [dcl.init]. */ |
4030 | gcc_assert (!MAYBE_CLASS_TYPE_P (fromtype) || !MAYBE_CLASS_TYPE_P (totype)((void)(!(!((((enum tree_code) (fromtype)->base.code) == TEMPLATE_TYPE_PARM || ((enum tree_code) (fromtype)->base.code) == TYPENAME_TYPE || ((enum tree_code) (fromtype)->base.code) == TYPEOF_TYPE || ((enum tree_code) (fromtype)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM || ((enum tree_code) (fromtype)->base.code) == DECLTYPE_TYPE ) || (((((enum tree_code) (fromtype)->base.code)) == RECORD_TYPE || (((enum tree_code) (fromtype)->base.code)) == UNION_TYPE ) && ((tree_class_check ((fromtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4030, __FUNCTION__))->type_common.lang_flag_5))) || !((( (enum tree_code) (totype)->base.code) == TEMPLATE_TYPE_PARM || ((enum tree_code) (totype)->base.code) == TYPENAME_TYPE || ((enum tree_code) (totype)->base.code) == TYPEOF_TYPE || ((enum tree_code) (totype)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM || ((enum tree_code) (totype)->base.code) == DECLTYPE_TYPE ) || (((((enum tree_code) (totype)->base.code)) == RECORD_TYPE || (((enum tree_code) (totype)->base.code)) == UNION_TYPE ) && ((tree_class_check ((totype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4030, __FUNCTION__))->type_common.lang_flag_5))) || !(lookup_base ((fromtype), (totype), ba_any, __null, tf_none) != (tree) __null )) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4031, __FUNCTION__), 0 : 0)) |
4031 | || !DERIVED_FROM_P (totype, fromtype))((void)(!(!((((enum tree_code) (fromtype)->base.code) == TEMPLATE_TYPE_PARM || ((enum tree_code) (fromtype)->base.code) == TYPENAME_TYPE || ((enum tree_code) (fromtype)->base.code) == TYPEOF_TYPE || ((enum tree_code) (fromtype)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM || ((enum tree_code) (fromtype)->base.code) == DECLTYPE_TYPE ) || (((((enum tree_code) (fromtype)->base.code)) == RECORD_TYPE || (((enum tree_code) (fromtype)->base.code)) == UNION_TYPE ) && ((tree_class_check ((fromtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4030, __FUNCTION__))->type_common.lang_flag_5))) || !((( (enum tree_code) (totype)->base.code) == TEMPLATE_TYPE_PARM || ((enum tree_code) (totype)->base.code) == TYPENAME_TYPE || ((enum tree_code) (totype)->base.code) == TYPEOF_TYPE || ((enum tree_code) (totype)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM || ((enum tree_code) (totype)->base.code) == DECLTYPE_TYPE ) || (((((enum tree_code) (totype)->base.code)) == RECORD_TYPE || (((enum tree_code) (totype)->base.code)) == UNION_TYPE ) && ((tree_class_check ((totype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4030, __FUNCTION__))->type_common.lang_flag_5))) || !(lookup_base ((fromtype), (totype), ba_any, __null, tf_none) != (tree) __null )) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4031, __FUNCTION__), 0 : 0)); |
4032 | |
4033 | if (CLASS_TYPE_P (totype)(((((enum tree_code) (totype)->base.code)) == RECORD_TYPE || (((enum tree_code) (totype)->base.code)) == UNION_TYPE) && ((tree_class_check ((totype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4033, __FUNCTION__))->type_common.lang_flag_5))) |
4034 | /* Use lookup_fnfields_slot instead of lookup_fnfields to avoid |
4035 | creating a garbage BASELINK; constructors can't be inherited. */ |
4036 | ctors = get_class_binding (totype, complete_ctor_identifiercp_global_trees[CPTI_COMPLETE_CTOR_IDENTIFIER]); |
4037 | |
4038 | tree to_nonref = non_reference (totype); |
4039 | if (MAYBE_CLASS_TYPE_P (fromtype)((((enum tree_code) (fromtype)->base.code) == TEMPLATE_TYPE_PARM || ((enum tree_code) (fromtype)->base.code) == TYPENAME_TYPE || ((enum tree_code) (fromtype)->base.code) == TYPEOF_TYPE || ((enum tree_code) (fromtype)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM || ((enum tree_code) (fromtype)->base.code) == DECLTYPE_TYPE ) || (((((enum tree_code) (fromtype)->base.code)) == RECORD_TYPE || (((enum tree_code) (fromtype)->base.code)) == UNION_TYPE ) && ((tree_class_check ((fromtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4039, __FUNCTION__))->type_common.lang_flag_5)))) |
4040 | { |
4041 | if (same_type_ignoring_top_level_qualifiers_p (to_nonref, fromtype) || |
4042 | (CLASS_TYPE_P (to_nonref)(((((enum tree_code) (to_nonref)->base.code)) == RECORD_TYPE || (((enum tree_code) (to_nonref)->base.code)) == UNION_TYPE ) && ((tree_class_check ((to_nonref), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4042, __FUNCTION__))->type_common.lang_flag_5)) && CLASS_TYPE_P (fromtype)(((((enum tree_code) (fromtype)->base.code)) == RECORD_TYPE || (((enum tree_code) (fromtype)->base.code)) == UNION_TYPE ) && ((tree_class_check ((fromtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4042, __FUNCTION__))->type_common.lang_flag_5)) |
4043 | && DERIVED_FROM_P (to_nonref, fromtype)(lookup_base ((fromtype), (to_nonref), ba_any, __null, tf_none ) != (tree) __null))) |
4044 | { |
4045 | /* [class.conv.fct] A conversion function is never used to |
4046 | convert a (possibly cv-qualified) object to the (possibly |
4047 | cv-qualified) same object type (or a reference to it), to a |
4048 | (possibly cv-qualified) base class of that type (or a |
4049 | reference to it)... */ |
4050 | } |
4051 | else |
4052 | conv_fns = lookup_conversions (fromtype); |
4053 | } |
4054 | |
4055 | candidates = 0; |
4056 | flags |= LOOKUP_NO_CONVERSION(1 << 4); |
4057 | if (BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR && ((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4057, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE ])) |
4058 | flags |= LOOKUP_NO_NARROWING(((1 << 6) << 1) << 1); |
4059 | |
4060 | /* It's OK to bind a temporary for converting constructor arguments, but |
4061 | not in converting the return value of a conversion operator. */ |
4062 | convflags = ((flags & LOOKUP_NO_TEMP_BIND(1 << 6)) | LOOKUP_NO_CONVERSION(1 << 4) |
4063 | | (flags & LOOKUP_NO_NARROWING(((1 << 6) << 1) << 1))); |
4064 | flags &= ~LOOKUP_NO_TEMP_BIND(1 << 6); |
4065 | |
4066 | if (ctors) |
4067 | { |
4068 | int ctorflags = flags; |
4069 | |
4070 | first_arg = build_dummy_object (totype); |
4071 | |
4072 | /* We should never try to call the abstract or base constructor |
4073 | from here. */ |
4074 | gcc_assert (!DECL_HAS_IN_CHARGE_PARM_P (OVL_FIRST (ctors))((void)(!(!(__extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (ovl_first (ctors))->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((ovl_first (ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4074, __FUNCTION__, (TEMPLATE_DECL))))))))->result : ovl_first (ctors))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4074, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) (ovl_first (ctors))->base.code) == FUNCTION_DECL || (((enum tree_code) (ovl_first (ctors))->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((ovl_first (ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4074, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((ovl_first (ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4074, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4074, __FUNCTION__); <->u.fn; })->has_in_charge_parm_p ) && !(__extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (ovl_first (ctors))->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((ovl_first (ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4075, __FUNCTION__, (TEMPLATE_DECL))))))))->result : ovl_first (ctors))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4075, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) (ovl_first (ctors))->base.code) == FUNCTION_DECL || (((enum tree_code) (ovl_first (ctors))->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((ovl_first (ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4075, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((ovl_first (ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4075, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4075, __FUNCTION__); <->u.fn; })->has_vtt_parm_p )) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4075, __FUNCTION__), 0 : 0)) |
4075 | && !DECL_HAS_VTT_PARM_P (OVL_FIRST (ctors)))((void)(!(!(__extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (ovl_first (ctors))->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((ovl_first (ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4074, __FUNCTION__, (TEMPLATE_DECL))))))))->result : ovl_first (ctors))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4074, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) (ovl_first (ctors))->base.code) == FUNCTION_DECL || (((enum tree_code) (ovl_first (ctors))->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((ovl_first (ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4074, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((ovl_first (ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4074, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4074, __FUNCTION__); <->u.fn; })->has_in_charge_parm_p ) && !(__extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (ovl_first (ctors))->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((ovl_first (ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4075, __FUNCTION__, (TEMPLATE_DECL))))))))->result : ovl_first (ctors))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4075, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) (ovl_first (ctors))->base.code) == FUNCTION_DECL || (((enum tree_code) (ovl_first (ctors))->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((ovl_first (ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4075, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((ovl_first (ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4075, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4075, __FUNCTION__); <->u.fn; })->has_vtt_parm_p )) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4075, __FUNCTION__), 0 : 0)); |
4076 | |
4077 | args = make_tree_vector_single (expr); |
4078 | if (BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR && ((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4078, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE ])) |
4079 | { |
4080 | /* List-initialization. */ |
4081 | add_list_candidates (ctors, first_arg, args, totype, NULL_TREE(tree) __null, |
4082 | false, TYPE_BINFO (totype)((tree_check3 ((totype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4082, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.maxval), TYPE_BINFO (totype)((tree_check3 ((totype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4082, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.maxval), |
4083 | ctorflags, &candidates, complain); |
4084 | } |
4085 | else |
4086 | { |
4087 | add_candidates (ctors, first_arg, args, NULL_TREE(tree) __null, NULL_TREE(tree) __null, false, |
4088 | TYPE_BINFO (totype)((tree_check3 ((totype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4088, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.maxval), TYPE_BINFO (totype)((tree_check3 ((totype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4088, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.maxval), |
4089 | ctorflags, &candidates, complain); |
4090 | } |
4091 | |
4092 | for (cand = candidates; cand; cand = cand->next) |
4093 | { |
4094 | cand->second_conv = build_identity_conv (totype, NULL_TREE(tree) __null); |
4095 | |
4096 | /* If totype isn't a reference, and LOOKUP_NO_TEMP_BIND isn't |
4097 | set, then this is copy-initialization. In that case, "The |
4098 | result of the call is then used to direct-initialize the |
4099 | object that is the destination of the copy-initialization." |
4100 | [dcl.init] |
4101 | |
4102 | We represent this in the conversion sequence with an |
4103 | rvalue conversion, which means a constructor call. */ |
4104 | if (!TYPE_REF_P (totype)(((enum tree_code) (totype)->base.code) == REFERENCE_TYPE) |
4105 | && !(convflags & LOOKUP_NO_TEMP_BIND(1 << 6))) |
4106 | cand->second_conv |
4107 | = build_conv (ck_rvalue, totype, cand->second_conv); |
4108 | } |
4109 | } |
4110 | |
4111 | if (conv_fns) |
4112 | { |
4113 | if (BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR && ((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4113, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE ])) |
4114 | first_arg = CONSTRUCTOR_ELT (expr, 0)(&(*((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4114, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[ 0])->value; |
4115 | else |
4116 | first_arg = expr; |
4117 | } |
4118 | |
4119 | for (; conv_fns; conv_fns = TREE_CHAIN (conv_fns)((contains_struct_check ((conv_fns), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4119, __FUNCTION__))->common.chain)) |
4120 | { |
4121 | tree conversion_path = TREE_PURPOSE (conv_fns)((tree_check ((conv_fns), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4121, __FUNCTION__, (TREE_LIST)))->list.purpose); |
4122 | struct z_candidate *old_candidates; |
4123 | |
4124 | /* If LOOKUP_NO_CONVERSION, don't consider a conversion function that |
4125 | would need an addional user-defined conversion, i.e. if the return |
4126 | type differs in class-ness from the desired type. So we avoid |
4127 | considering operator bool when calling a copy constructor. |
4128 | |
4129 | This optimization avoids the failure in PR97600, and is allowed by |
4130 | [temp.inst]/9: "If the function selected by overload resolution can be |
4131 | determined without instantiating a class template definition, it is |
4132 | unspecified whether that instantiation actually takes place." */ |
4133 | tree convtype = non_reference (TREE_TYPE (conv_fns)((contains_struct_check ((conv_fns), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4133, __FUNCTION__))->typed.type)); |
4134 | if ((flags & LOOKUP_NO_CONVERSION(1 << 4)) |
4135 | && !WILDCARD_TYPE_P (convtype)(((enum tree_code) (convtype)->base.code) == TEMPLATE_TYPE_PARM || ((enum tree_code) (convtype)->base.code) == TYPENAME_TYPE || ((enum tree_code) (convtype)->base.code) == TYPEOF_TYPE || ((enum tree_code) (convtype)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM || ((enum tree_code) (convtype)->base.code) == DECLTYPE_TYPE ) |
4136 | && (CLASS_TYPE_P (to_nonref)(((((enum tree_code) (to_nonref)->base.code)) == RECORD_TYPE || (((enum tree_code) (to_nonref)->base.code)) == UNION_TYPE ) && ((tree_class_check ((to_nonref), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4136, __FUNCTION__))->type_common.lang_flag_5)) |
4137 | != CLASS_TYPE_P (convtype)(((((enum tree_code) (convtype)->base.code)) == RECORD_TYPE || (((enum tree_code) (convtype)->base.code)) == UNION_TYPE ) && ((tree_class_check ((convtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4137, __FUNCTION__))->type_common.lang_flag_5)))) |
4138 | continue; |
4139 | |
4140 | /* If we are called to convert to a reference type, we are trying to |
4141 | find a direct binding, so don't even consider temporaries. If |
4142 | we don't find a direct binding, the caller will try again to |
4143 | look for a temporary binding. */ |
4144 | if (TYPE_REF_P (totype)(((enum tree_code) (totype)->base.code) == REFERENCE_TYPE)) |
4145 | convflags |= LOOKUP_NO_TEMP_BIND(1 << 6); |
4146 | |
4147 | old_candidates = candidates; |
4148 | add_candidates (TREE_VALUE (conv_fns)((tree_check ((conv_fns), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4148, __FUNCTION__, (TREE_LIST)))->list.value), first_arg, NULL__null, totype, |
4149 | NULL_TREE(tree) __null, false, |
4150 | conversion_path, TYPE_BINFO (fromtype)((tree_check3 ((fromtype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4150, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.maxval), |
4151 | flags, &candidates, complain); |
4152 | |
4153 | for (cand = candidates; cand != old_candidates; cand = cand->next) |
4154 | { |
4155 | if (cand->viable == 0) |
4156 | /* Already rejected, don't change to -1. */ |
4157 | continue; |
4158 | |
4159 | tree rettype = TREE_TYPE (TREE_TYPE (cand->fn))((contains_struct_check ((((contains_struct_check ((cand-> fn), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4159, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4159, __FUNCTION__))->typed.type); |
4160 | conversion *ics |
4161 | = implicit_conversion (totype, |
4162 | rettype, |
4163 | 0, |
4164 | /*c_cast_p=*/false, convflags, |
4165 | complain); |
4166 | |
4167 | /* If LOOKUP_NO_TEMP_BIND isn't set, then this is |
4168 | copy-initialization. In that case, "The result of the |
4169 | call is then used to direct-initialize the object that is |
4170 | the destination of the copy-initialization." [dcl.init] |
4171 | |
4172 | We represent this in the conversion sequence with an |
4173 | rvalue conversion, which means a constructor call. But |
4174 | don't add a second rvalue conversion if there's already |
4175 | one there. Which there really shouldn't be, but it's |
4176 | harmless since we'd add it here anyway. */ |
4177 | if (ics && MAYBE_CLASS_TYPE_P (totype)((((enum tree_code) (totype)->base.code) == TEMPLATE_TYPE_PARM || ((enum tree_code) (totype)->base.code) == TYPENAME_TYPE || ((enum tree_code) (totype)->base.code) == TYPEOF_TYPE || ((enum tree_code) (totype)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM || ((enum tree_code) (totype)->base.code) == DECLTYPE_TYPE ) || (((((enum tree_code) (totype)->base.code)) == RECORD_TYPE || (((enum tree_code) (totype)->base.code)) == UNION_TYPE ) && ((tree_class_check ((totype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4177, __FUNCTION__))->type_common.lang_flag_5))) && ics->kind != ck_rvalue |
4178 | && !(convflags & LOOKUP_NO_TEMP_BIND(1 << 6))) |
4179 | ics = build_conv (ck_rvalue, totype, ics); |
4180 | |
4181 | cand->second_conv = ics; |
4182 | |
4183 | if (!ics) |
4184 | { |
4185 | cand->viable = 0; |
4186 | cand->reason = arg_conversion_rejection (NULL_TREE(tree) __null, -2, |
4187 | rettype, totype, |
4188 | EXPR_LOCATION (expr)((((expr)) && ((tree_code_type[(int) (((enum tree_code ) ((expr))->base.code))]) >= tcc_reference && ( tree_code_type[(int) (((enum tree_code) ((expr))->base.code ))]) <= tcc_expression)) ? (expr)->exp.locus : ((location_t ) 0))); |
4189 | } |
4190 | else if (TYPE_REF_P (totype)(((enum tree_code) (totype)->base.code) == REFERENCE_TYPE) && !ics->rvaluedness_matches_p |
4191 | /* Limit this to non-templates for now (PR90546). */ |
4192 | && !cand->template_decl |
4193 | && TREE_CODE (TREE_TYPE (totype))((enum tree_code) (((contains_struct_check ((totype), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4193, __FUNCTION__))->typed.type))->base.code) != FUNCTION_TYPE) |
4194 | { |
4195 | /* If we are called to convert to a reference type, we are trying |
4196 | to find a direct binding per [over.match.ref], so rvaluedness |
4197 | must match for non-functions. */ |
4198 | cand->viable = 0; |
4199 | } |
4200 | else if (DECL_NONCONVERTING_P (cand->fn)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (cand->fn)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((cand->fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4200, __FUNCTION__, (TEMPLATE_DECL))))))))->result : cand ->fn)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4200, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) (cand->fn)->base.code) == FUNCTION_DECL || (((enum tree_code) (cand->fn)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((cand->fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4200, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((cand ->fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4200, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4200, __FUNCTION__); <->u.fn; })->nonconverting ) |
4201 | && ics->rank > cr_exact) |
4202 | { |
4203 | /* 13.3.1.5: For direct-initialization, those explicit |
4204 | conversion functions that are not hidden within S and |
4205 | yield type T or a type that can be converted to type T |
4206 | with a qualification conversion (4.4) are also candidate |
4207 | functions. */ |
4208 | /* 13.3.1.6 doesn't have a parallel restriction, but it should; |
4209 | I've raised this issue with the committee. --jason 9/2011 */ |
4210 | cand->viable = -1; |
4211 | cand->reason = explicit_conversion_rejection (rettype, totype); |
4212 | } |
4213 | else if (cand->viable == 1 && ics->bad_p) |
4214 | { |
4215 | cand->viable = -1; |
4216 | cand->reason |
4217 | = bad_arg_conversion_rejection (NULL_TREE(tree) __null, -2, |
4218 | rettype, totype, |
4219 | EXPR_LOCATION (expr)((((expr)) && ((tree_code_type[(int) (((enum tree_code ) ((expr))->base.code))]) >= tcc_reference && ( tree_code_type[(int) (((enum tree_code) ((expr))->base.code ))]) <= tcc_expression)) ? (expr)->exp.locus : ((location_t ) 0))); |
4220 | } |
4221 | else if (primary_template_specialization_p (cand->fn) |
4222 | && ics->rank > cr_exact) |
4223 | { |
4224 | /* 13.3.3.1.2: If the user-defined conversion is specified by |
4225 | a specialization of a conversion function template, the |
4226 | second standard conversion sequence shall have exact match |
4227 | rank. */ |
4228 | cand->viable = -1; |
4229 | cand->reason = template_conversion_rejection (rettype, totype); |
4230 | } |
4231 | } |
4232 | } |
4233 | |
4234 | candidates = splice_viable (candidates, false, &any_viable_p); |
4235 | if (!any_viable_p) |
4236 | { |
4237 | if (args) |
4238 | release_tree_vector (args); |
4239 | return NULL__null; |
4240 | } |
4241 | |
4242 | cand = tourney (candidates, complain); |
4243 | if (cand == NULL__null) |
4244 | { |
4245 | if (complain & tf_error) |
4246 | { |
4247 | auto_diagnostic_group d; |
4248 | error_at (cp_expr_loc_or_input_loc (expr), |
4249 | "conversion from %qH to %qI is ambiguous", |
4250 | fromtype, totype); |
4251 | print_z_candidates (location_of (expr), candidates); |
4252 | } |
4253 | |
4254 | cand = candidates; /* any one will do */ |
4255 | cand->second_conv = build_ambiguous_conv (totype, expr); |
4256 | cand->second_conv->user_conv_p = true; |
4257 | if (!any_strictly_viable (candidates)) |
4258 | cand->second_conv->bad_p = true; |
4259 | if (flags & LOOKUP_ONLYCONVERTING(1 << 2)) |
4260 | cand->second_conv->need_temporary_p = true; |
4261 | /* If there are viable candidates, don't set ICS_BAD_FLAG; an |
4262 | ambiguous conversion is no worse than another user-defined |
4263 | conversion. */ |
4264 | |
4265 | return cand; |
4266 | } |
4267 | |
4268 | tree convtype; |
4269 | if (!DECL_CONSTRUCTOR_P (cand->fn)((tree_check (((((enum tree_code) (cand->fn)->base.code ) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast <union tree_node *> ((((tree_check ((cand->fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4269, __FUNCTION__, (TEMPLATE_DECL))))))))->result : cand ->fn)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4269, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor )) |
4270 | convtype = non_reference (TREE_TYPE (TREE_TYPE (cand->fn))((contains_struct_check ((((contains_struct_check ((cand-> fn), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4270, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4270, __FUNCTION__))->typed.type)); |
4271 | else if (cand->second_conv->kind == ck_rvalue) |
4272 | /* DR 5: [in the first step of copy-initialization]...if the function |
4273 | is a constructor, the call initializes a temporary of the |
4274 | cv-unqualified version of the destination type. */ |
4275 | convtype = cv_unqualified (totype); |
4276 | else |
4277 | convtype = totype; |
4278 | /* Build the user conversion sequence. */ |
4279 | conv = build_conv |
4280 | (ck_user, |
4281 | convtype, |
4282 | build_identity_conv (TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4282, __FUNCTION__))->typed.type), expr)); |
4283 | conv->cand = cand; |
4284 | if (cand->viable == -1) |
4285 | conv->bad_p = true; |
4286 | |
4287 | /* We're performing the maybe-rvalue overload resolution and |
4288 | a conversion function is in play. Reject converting the return |
4289 | value of the conversion function to a base class. */ |
4290 | if ((flags & LOOKUP_PREFER_RVALUE((1 << 6) << 1)) && !DECL_CONSTRUCTOR_P (cand->fn)((tree_check (((((enum tree_code) (cand->fn)->base.code ) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast <union tree_node *> ((((tree_check ((cand->fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4290, __FUNCTION__, (TEMPLATE_DECL))))))))->result : cand ->fn)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4290, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor )) |
4291 | for (conversion *t = cand->second_conv; t; t = next_conversion (t)) |
4292 | if (t->kind == ck_base) |
4293 | return NULL__null; |
4294 | |
4295 | /* Remember that this was a list-initialization. */ |
4296 | if (flags & LOOKUP_NO_NARROWING(((1 << 6) << 1) << 1)) |
4297 | conv->check_narrowing = true; |
4298 | |
4299 | /* Combine it with the second conversion sequence. */ |
4300 | cand->second_conv = merge_conversion_sequences (conv, |
4301 | cand->second_conv); |
4302 | |
4303 | return cand; |
4304 | } |
4305 | |
4306 | /* Wrapper for above. */ |
4307 | |
4308 | tree |
4309 | build_user_type_conversion (tree totype, tree expr, int flags, |
4310 | tsubst_flags_t complain) |
4311 | { |
4312 | struct z_candidate *cand; |
4313 | tree ret; |
4314 | |
4315 | bool subtime = timevar_cond_start (TV_OVERLOAD); |
4316 | cand = build_user_type_conversion_1 (totype, expr, flags, complain); |
4317 | |
4318 | if (cand) |
4319 | { |
4320 | if (cand->second_conv->kind == ck_ambig) |
4321 | ret = error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4322 | else |
4323 | { |
4324 | expr = convert_like (cand->second_conv, expr, complain); |
4325 | ret = convert_from_reference (expr); |
4326 | } |
4327 | } |
4328 | else |
4329 | ret = NULL_TREE(tree) __null; |
4330 | |
4331 | timevar_cond_stop (TV_OVERLOAD, subtime); |
4332 | return ret; |
4333 | } |
4334 | |
4335 | /* Give a helpful diagnostic when implicit_conversion fails. */ |
4336 | |
4337 | static void |
4338 | implicit_conversion_error (location_t loc, tree type, tree expr) |
4339 | { |
4340 | tsubst_flags_t complain = tf_warning_or_error; |
4341 | |
4342 | /* If expr has unknown type, then it is an overloaded function. |
4343 | Call instantiate_type to get good error messages. */ |
4344 | if (TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4344, __FUNCTION__))->typed.type) == unknown_type_nodecp_global_trees[CPTI_UNKNOWN_TYPE]) |
4345 | instantiate_type (type, expr, complain); |
4346 | else if (invalid_nonstatic_memfn_p (loc, expr, complain)) |
4347 | /* We gave an error. */; |
4348 | else if (BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR && ((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4348, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE ]) |
4349 | && CONSTRUCTOR_IS_DESIGNATED_INIT (expr)(((tree_not_check2 (((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4349, __FUNCTION__, (CONSTRUCTOR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4349, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_6)) |
4350 | && !CP_AGGREGATE_TYPE_P (type)(gnu_vector_type_p (type) || ((enum tree_code) (type)->base .code) == ARRAY_TYPE || ((((((enum tree_code) (type)->base .code)) == RECORD_TYPE || (((enum tree_code) (type)->base. code)) == UNION_TYPE) && ((tree_class_check ((type), ( tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4350, __FUNCTION__))->type_common.lang_flag_5)) && (((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4350, __FUNCTION__))->type_common.size) != (tree) __null ) && !((((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4350, __FUNCTION__))->type_with_lang_specific.lang_specific ))->non_aggregate)))) |
4351 | error_at (loc, "designated initializers cannot be used with a " |
4352 | "non-aggregate type %qT", type); |
4353 | else |
4354 | { |
4355 | range_label_for_type_mismatch label (TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4355, __FUNCTION__))->typed.type), type); |
4356 | gcc_rich_location rich_loc (loc, &label); |
4357 | error_at (&rich_loc, "could not convert %qE from %qH to %qI", |
4358 | expr, TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4358, __FUNCTION__))->typed.type), type); |
4359 | } |
4360 | } |
4361 | |
4362 | /* Worker for build_converted_constant_expr. */ |
4363 | |
4364 | static tree |
4365 | build_converted_constant_expr_internal (tree type, tree expr, |
4366 | int flags, tsubst_flags_t complain) |
4367 | { |
4368 | conversion *conv; |
4369 | void *p; |
4370 | tree t; |
4371 | location_t loc = cp_expr_loc_or_input_loc (expr); |
4372 | |
4373 | if (error_operand_p (expr)((expr) == global_trees[TI_ERROR_MARK] || ((expr) && ( (contains_struct_check (((expr)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4373, __FUNCTION__))->typed.type) == global_trees[TI_ERROR_MARK ]))) |
4374 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4375 | |
4376 | /* Get the high-water mark for the CONVERSION_OBSTACK. */ |
4377 | p = conversion_obstack_alloc (0); |
4378 | |
4379 | conv = implicit_conversion (type, TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4379, __FUNCTION__))->typed.type), expr, |
4380 | /*c_cast_p=*/false, flags, complain); |
4381 | |
4382 | /* A converted constant expression of type T is an expression, implicitly |
4383 | converted to type T, where the converted expression is a constant |
4384 | expression and the implicit conversion sequence contains only |
4385 | |
4386 | * user-defined conversions, |
4387 | * lvalue-to-rvalue conversions (7.1), |
4388 | * array-to-pointer conversions (7.2), |
4389 | * function-to-pointer conversions (7.3), |
4390 | * qualification conversions (7.5), |
4391 | * integral promotions (7.6), |
4392 | * integral conversions (7.8) other than narrowing conversions (11.6.4), |
4393 | * null pointer conversions (7.11) from std::nullptr_t, |
4394 | * null member pointer conversions (7.12) from std::nullptr_t, and |
4395 | * function pointer conversions (7.13), |
4396 | |
4397 | and where the reference binding (if any) binds directly. */ |
4398 | |
4399 | for (conversion *c = conv; |
4400 | c && c->kind != ck_identity; |
4401 | c = next_conversion (c)) |
4402 | { |
4403 | switch (c->kind) |
4404 | { |
4405 | /* A conversion function is OK. If it isn't constexpr, we'll |
4406 | complain later that the argument isn't constant. */ |
4407 | case ck_user: |
4408 | /* List-initialization is OK. */ |
4409 | case ck_aggr: |
4410 | /* The lvalue-to-rvalue conversion is OK. */ |
4411 | case ck_rvalue: |
4412 | /* Array-to-pointer and function-to-pointer. */ |
4413 | case ck_lvalue: |
4414 | /* Function pointer conversions. */ |
4415 | case ck_fnptr: |
4416 | /* Qualification conversions. */ |
4417 | case ck_qual: |
4418 | break; |
4419 | |
4420 | case ck_ref_bind: |
4421 | if (c->need_temporary_p) |
4422 | { |
4423 | if (complain & tf_error) |
4424 | error_at (loc, "initializing %qH with %qI in converted " |
4425 | "constant expression does not bind directly", |
4426 | type, next_conversion (c)->type); |
4427 | conv = NULL__null; |
4428 | } |
4429 | break; |
4430 | |
4431 | case ck_base: |
4432 | case ck_pmem: |
4433 | case ck_ptr: |
4434 | case ck_std: |
4435 | t = next_conversion (c)->type; |
4436 | if (INTEGRAL_OR_ENUMERATION_TYPE_P (t)(((enum tree_code) (t)->base.code) == ENUMERAL_TYPE || ((( enum tree_code) (t)->base.code) == BOOLEAN_TYPE || ((enum tree_code ) (t)->base.code) == INTEGER_TYPE)) |
4437 | && INTEGRAL_OR_ENUMERATION_TYPE_P (type)(((enum tree_code) (type)->base.code) == ENUMERAL_TYPE || ( ((enum tree_code) (type)->base.code) == BOOLEAN_TYPE || (( enum tree_code) (type)->base.code) == INTEGER_TYPE))) |
4438 | /* Integral promotion or conversion. */ |
4439 | break; |
4440 | if (NULLPTR_TYPE_P (t)(((enum tree_code) (t)->base.code) == NULLPTR_TYPE)) |
4441 | /* Conversion from nullptr to pointer or pointer-to-member. */ |
4442 | break; |
4443 | |
4444 | if (complain & tf_error) |
4445 | error_at (loc, "conversion from %qH to %qI in a " |
4446 | "converted constant expression", t, type); |
4447 | /* fall through. */ |
4448 | |
4449 | default: |
4450 | conv = NULL__null; |
4451 | break; |
4452 | } |
4453 | } |
4454 | |
4455 | /* Avoid confusing convert_nontype_argument by introducing |
4456 | a redundant conversion to the same reference type. */ |
4457 | if (conv && conv->kind == ck_ref_bind |
4458 | && REFERENCE_REF_P (expr)((((enum tree_code) (expr)->base.code) == INDIRECT_REF) && ((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((expr), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4458, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4458, __FUNCTION__))->typed.type) && (((enum tree_code ) (((contains_struct_check (((*((const_cast<tree*> (tree_operand_check (((expr)), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4458, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4458, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE ))) |
4459 | { |
4460 | tree ref = TREE_OPERAND (expr, 0)(*((const_cast<tree*> (tree_operand_check ((expr), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4460, __FUNCTION__))))); |
4461 | if (same_type_p (type, TREE_TYPE (ref))comptypes ((type), (((contains_struct_check ((ref), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4461, __FUNCTION__))->typed.type)), 0)) |
4462 | return ref; |
4463 | } |
4464 | |
4465 | if (conv) |
4466 | { |
4467 | /* Don't copy a class in a template. */ |
4468 | if (CLASS_TYPE_P (type)(((((enum tree_code) (type)->base.code)) == RECORD_TYPE || (((enum tree_code) (type)->base.code)) == UNION_TYPE) && ((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4468, __FUNCTION__))->type_common.lang_flag_5)) && conv->kind == ck_rvalue |
4469 | && processing_template_declscope_chain->x_processing_template_decl) |
4470 | conv = next_conversion (conv); |
4471 | |
4472 | conv->check_narrowing = true; |
4473 | conv->check_narrowing_const_only = true; |
4474 | expr = convert_like (conv, expr, complain); |
4475 | } |
4476 | else |
4477 | { |
4478 | if (complain & tf_error) |
4479 | implicit_conversion_error (loc, type, expr); |
4480 | expr = error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4481 | } |
4482 | |
4483 | /* Free all the conversions we allocated. */ |
4484 | obstack_free (&conversion_obstack, p)__extension__ ({ struct obstack *__o = (&conversion_obstack ); void *__obj = (void *) (p); if (__obj > (void *) __o-> chunk && __obj < (void *) __o->chunk_limit) __o ->next_free = __o->object_base = (char *) __obj; else _obstack_free (__o, __obj); }); |
4485 | |
4486 | return expr; |
4487 | } |
4488 | |
4489 | /* Subroutine of convert_nontype_argument. |
4490 | |
4491 | EXPR is an expression used in a context that requires a converted |
4492 | constant-expression, such as a template non-type parameter. Do any |
4493 | necessary conversions (that are permitted for converted |
4494 | constant-expressions) to convert it to the desired type. |
4495 | |
4496 | This function doesn't consider explicit conversion functions. If |
4497 | you mean to use "a contextually converted constant expression of type |
4498 | bool", use build_converted_constant_bool_expr. |
4499 | |
4500 | If conversion is successful, returns the converted expression; |
4501 | otherwise, returns error_mark_node. */ |
4502 | |
4503 | tree |
4504 | build_converted_constant_expr (tree type, tree expr, tsubst_flags_t complain) |
4505 | { |
4506 | return build_converted_constant_expr_internal (type, expr, LOOKUP_IMPLICIT(((1 << 0)) | (1 << 2)), |
4507 | complain); |
4508 | } |
4509 | |
4510 | /* Used to create "a contextually converted constant expression of type |
4511 | bool". This differs from build_converted_constant_expr in that it |
4512 | also considers explicit conversion functions. */ |
4513 | |
4514 | tree |
4515 | build_converted_constant_bool_expr (tree expr, tsubst_flags_t complain) |
4516 | { |
4517 | return build_converted_constant_expr_internal (boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], expr, |
4518 | LOOKUP_NORMAL((1 << 0)), complain); |
4519 | } |
4520 | |
4521 | /* Do any initial processing on the arguments to a function call. */ |
4522 | |
4523 | vec<tree, va_gc> * |
4524 | resolve_args (vec<tree, va_gc> *args, tsubst_flags_t complain) |
4525 | { |
4526 | unsigned int ix; |
4527 | tree arg; |
4528 | |
4529 | FOR_EACH_VEC_SAFE_ELT (args, ix, arg)for (ix = 0; vec_safe_iterate ((args), (ix), &(arg)); ++( ix)) |
4530 | { |
4531 | if (error_operand_p (arg)((arg) == global_trees[TI_ERROR_MARK] || ((arg) && (( contains_struct_check (((arg)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4531, __FUNCTION__))->typed.type) == global_trees[TI_ERROR_MARK ]))) |
4532 | return NULL__null; |
4533 | else if (VOID_TYPE_P (TREE_TYPE (arg))(((enum tree_code) (((contains_struct_check ((arg), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4533, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE )) |
4534 | { |
4535 | if (complain & tf_error) |
4536 | error_at (cp_expr_loc_or_input_loc (arg), |
4537 | "invalid use of void expression"); |
4538 | return NULL__null; |
4539 | } |
4540 | else if (invalid_nonstatic_memfn_p (EXPR_LOCATION (arg)((((arg)) && ((tree_code_type[(int) (((enum tree_code ) ((arg))->base.code))]) >= tcc_reference && (tree_code_type [(int) (((enum tree_code) ((arg))->base.code))]) <= tcc_expression )) ? (arg)->exp.locus : ((location_t) 0)), arg, complain)) |
4541 | return NULL__null; |
4542 | } |
4543 | return args; |
4544 | } |
4545 | |
4546 | /* Perform overload resolution on FN, which is called with the ARGS. |
4547 | |
4548 | Return the candidate function selected by overload resolution, or |
4549 | NULL if the event that overload resolution failed. In the case |
4550 | that overload resolution fails, *CANDIDATES will be the set of |
4551 | candidates considered, and ANY_VIABLE_P will be set to true or |
4552 | false to indicate whether or not any of the candidates were |
4553 | viable. |
4554 | |
4555 | The ARGS should already have gone through RESOLVE_ARGS before this |
4556 | function is called. */ |
4557 | |
4558 | static struct z_candidate * |
4559 | perform_overload_resolution (tree fn, |
4560 | const vec<tree, va_gc> *args, |
4561 | struct z_candidate **candidates, |
4562 | bool *any_viable_p, tsubst_flags_t complain) |
4563 | { |
4564 | struct z_candidate *cand; |
4565 | tree explicit_targs; |
4566 | int template_only; |
4567 | |
4568 | bool subtime = timevar_cond_start (TV_OVERLOAD); |
4569 | |
4570 | explicit_targs = NULL_TREE(tree) __null; |
4571 | template_only = 0; |
4572 | |
4573 | *candidates = NULL__null; |
4574 | *any_viable_p = true; |
4575 | |
4576 | /* Check FN. */ |
4577 | gcc_assert (OVL_P (fn) || TREE_CODE (fn) == TEMPLATE_ID_EXPR)((void)(!((((enum tree_code) (fn)->base.code) == FUNCTION_DECL || ((enum tree_code) (fn)->base.code) == OVERLOAD) || ((enum tree_code) (fn)->base.code) == TEMPLATE_ID_EXPR) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4577, __FUNCTION__), 0 : 0)); |
4578 | |
4579 | if (TREE_CODE (fn)((enum tree_code) (fn)->base.code) == TEMPLATE_ID_EXPR) |
4580 | { |
4581 | explicit_targs = TREE_OPERAND (fn, 1)(*((const_cast<tree*> (tree_operand_check ((fn), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4581, __FUNCTION__))))); |
4582 | fn = TREE_OPERAND (fn, 0)(*((const_cast<tree*> (tree_operand_check ((fn), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4582, __FUNCTION__))))); |
4583 | template_only = 1; |
4584 | } |
4585 | |
4586 | /* Add the various candidate functions. */ |
4587 | add_candidates (fn, NULL_TREE(tree) __null, args, NULL_TREE(tree) __null, |
4588 | explicit_targs, template_only, |
4589 | /*conversion_path=*/NULL_TREE(tree) __null, |
4590 | /*access_path=*/NULL_TREE(tree) __null, |
4591 | LOOKUP_NORMAL((1 << 0)), |
4592 | candidates, complain); |
4593 | |
4594 | *candidates = splice_viable (*candidates, false, any_viable_p); |
4595 | if (*any_viable_p) |
4596 | cand = tourney (*candidates, complain); |
4597 | else |
4598 | cand = NULL__null; |
4599 | |
4600 | timevar_cond_stop (TV_OVERLOAD, subtime); |
4601 | return cand; |
4602 | } |
4603 | |
4604 | /* Print an error message about being unable to build a call to FN with |
4605 | ARGS. ANY_VIABLE_P indicates whether any candidate functions could |
4606 | be located; CANDIDATES is a possibly empty list of such |
4607 | functions. */ |
4608 | |
4609 | static void |
4610 | print_error_for_call_failure (tree fn, vec<tree, va_gc> *args, |
4611 | struct z_candidate *candidates) |
4612 | { |
4613 | tree targs = NULL_TREE(tree) __null; |
4614 | if (TREE_CODE (fn)((enum tree_code) (fn)->base.code) == TEMPLATE_ID_EXPR) |
4615 | { |
4616 | targs = TREE_OPERAND (fn, 1)(*((const_cast<tree*> (tree_operand_check ((fn), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4616, __FUNCTION__))))); |
4617 | fn = TREE_OPERAND (fn, 0)(*((const_cast<tree*> (tree_operand_check ((fn), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4617, __FUNCTION__))))); |
4618 | } |
4619 | tree name = OVL_NAME (fn)((contains_struct_check ((ovl_first (fn)), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4619, __FUNCTION__))->decl_minimal.name); |
4620 | location_t loc = location_of (name); |
4621 | if (targs) |
4622 | name = lookup_template_function (name, targs); |
4623 | |
4624 | auto_diagnostic_group d; |
4625 | if (!any_strictly_viable (candidates)) |
4626 | error_at (loc, "no matching function for call to %<%D(%A)%>", |
4627 | name, build_tree_list_vec (args)); |
4628 | else |
4629 | error_at (loc, "call of overloaded %<%D(%A)%> is ambiguous", |
4630 | name, build_tree_list_vec (args)); |
4631 | if (candidates) |
4632 | print_z_candidates (loc, candidates); |
4633 | } |
4634 | |
4635 | /* Return an expression for a call to FN (a namespace-scope function, |
4636 | or a static member function) with the ARGS. This may change |
4637 | ARGS. */ |
4638 | |
4639 | tree |
4640 | build_new_function_call (tree fn, vec<tree, va_gc> **args, |
4641 | tsubst_flags_t complain) |
4642 | { |
4643 | struct z_candidate *candidates, *cand; |
4644 | bool any_viable_p; |
4645 | void *p; |
4646 | tree result; |
4647 | |
4648 | if (args != NULL__null && *args != NULL__null) |
4649 | { |
4650 | *args = resolve_args (*args, complain); |
4651 | if (*args == NULL__null) |
4652 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4653 | } |
4654 | |
4655 | if (flag_tmglobal_options.x_flag_tm) |
4656 | tm_malloc_replacement (fn); |
4657 | |
4658 | /* Get the high-water mark for the CONVERSION_OBSTACK. */ |
4659 | p = conversion_obstack_alloc (0); |
4660 | |
4661 | cand = perform_overload_resolution (fn, *args, &candidates, &any_viable_p, |
4662 | complain); |
4663 | |
4664 | if (!cand) |
4665 | { |
4666 | if (complain & tf_error) |
4667 | { |
4668 | // If there is a single (non-viable) function candidate, |
4669 | // let the error be diagnosed by cp_build_function_call_vec. |
4670 | if (!any_viable_p && candidates && ! candidates->next |
4671 | && (TREE_CODE (candidates->fn)((enum tree_code) (candidates->fn)->base.code) == FUNCTION_DECL)) |
4672 | return cp_build_function_call_vec (candidates->fn, args, complain); |
4673 | |
4674 | // Otherwise, emit notes for non-viable candidates. |
4675 | print_error_for_call_failure (fn, *args, candidates); |
4676 | } |
4677 | result = error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4678 | } |
4679 | else |
4680 | { |
4681 | result = build_over_call (cand, LOOKUP_NORMAL((1 << 0)), complain); |
4682 | } |
4683 | |
4684 | if (flag_coroutinesglobal_options.x_flag_coroutines |
4685 | && result |
4686 | && TREE_CODE (result)((enum tree_code) (result)->base.code) == CALL_EXPR |
4687 | && DECL_BUILT_IN_CLASS (TREE_OPERAND (CALL_EXPR_FN (result), 0))((built_in_class) (tree_check (((*((const_cast<tree*> ( tree_operand_check (((*((const_cast<tree*> (tree_operand_check (((tree_check ((result), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4687, __FUNCTION__, (CALL_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4687, __FUNCTION__)))))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4687, __FUNCTION__)))))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4687, __FUNCTION__, (FUNCTION_DECL)))->function_decl.built_in_class ) |
4688 | == BUILT_IN_NORMAL) |
4689 | result = coro_validate_builtin_call (result); |
4690 | |
4691 | /* Free all the conversions we allocated. */ |
4692 | obstack_free (&conversion_obstack, p)__extension__ ({ struct obstack *__o = (&conversion_obstack ); void *__obj = (void *) (p); if (__obj > (void *) __o-> chunk && __obj < (void *) __o->chunk_limit) __o ->next_free = __o->object_base = (char *) __obj; else _obstack_free (__o, __obj); }); |
4693 | |
4694 | return result; |
4695 | } |
4696 | |
4697 | /* Build a call to a global operator new. FNNAME is the name of the |
4698 | operator (either "operator new" or "operator new[]") and ARGS are |
4699 | the arguments provided. This may change ARGS. *SIZE points to the |
4700 | total number of bytes required by the allocation, and is updated if |
4701 | that is changed here. *COOKIE_SIZE is non-NULL if a cookie should |
4702 | be used. If this function determines that no cookie should be |
4703 | used, after all, *COOKIE_SIZE is set to NULL_TREE. If SIZE_CHECK |
4704 | is not NULL_TREE, it is evaluated before calculating the final |
4705 | array size, and if it fails, the array size is replaced with |
4706 | (size_t)-1 (usually triggering a std::bad_alloc exception). If FN |
4707 | is non-NULL, it will be set, upon return, to the allocation |
4708 | function called. */ |
4709 | |
4710 | tree |
4711 | build_operator_new_call (tree fnname, vec<tree, va_gc> **args, |
4712 | tree *size, tree *cookie_size, |
4713 | tree align_arg, tree size_check, |
4714 | tree *fn, tsubst_flags_t complain) |
4715 | { |
4716 | tree original_size = *size; |
4717 | tree fns; |
4718 | struct z_candidate *candidates; |
4719 | struct z_candidate *cand = NULL__null; |
4720 | bool any_viable_p; |
4721 | |
4722 | if (fn) |
4723 | *fn = NULL_TREE(tree) __null; |
4724 | /* Set to (size_t)-1 if the size check fails. */ |
4725 | if (size_check != NULL_TREE(tree) __null) |
4726 | { |
4727 | tree errval = TYPE_MAX_VALUE (sizetype)((tree_check5 ((sizetype_tab[(int) stk_sizetype]), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4727, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ); |
4728 | if (cxx_dialect >= cxx11 && flag_exceptionsglobal_options.x_flag_exceptions) |
4729 | errval = throw_bad_array_new_length (); |
4730 | *size = fold_build3 (COND_EXPR, sizetype, size_check,fold_build3_loc (((location_t) 0), COND_EXPR, sizetype_tab[(int ) stk_sizetype], size_check, original_size, errval ) |
4731 | original_size, errval)fold_build3_loc (((location_t) 0), COND_EXPR, sizetype_tab[(int ) stk_sizetype], size_check, original_size, errval ); |
4732 | } |
4733 | vec_safe_insert (*args, 0, *size); |
4734 | *args = resolve_args (*args, complain); |
4735 | if (*args == NULL__null) |
4736 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4737 | |
4738 | /* Based on: |
4739 | |
4740 | [expr.new] |
4741 | |
4742 | If this lookup fails to find the name, or if the allocated type |
4743 | is not a class type, the allocation function's name is looked |
4744 | up in the global scope. |
4745 | |
4746 | we disregard block-scope declarations of "operator new". */ |
4747 | fns = lookup_name (fnname, LOOK_where::NAMESPACE); |
4748 | fns = lookup_arg_dependent (fnname, fns, *args); |
4749 | |
4750 | if (align_arg) |
4751 | { |
4752 | vec<tree, va_gc>* align_args |
4753 | = vec_copy_and_insert (*args, align_arg, 1); |
4754 | cand = perform_overload_resolution (fns, align_args, &candidates, |
4755 | &any_viable_p, tf_none); |
4756 | if (cand) |
4757 | *args = align_args; |
4758 | /* If no aligned allocation function matches, try again without the |
4759 | alignment. */ |
4760 | } |
4761 | |
4762 | /* Figure out what function is being called. */ |
4763 | if (!cand) |
4764 | cand = perform_overload_resolution (fns, *args, &candidates, &any_viable_p, |
4765 | complain); |
4766 | |
4767 | /* If no suitable function could be found, issue an error message |
4768 | and give up. */ |
4769 | if (!cand) |
4770 | { |
4771 | if (complain & tf_error) |
4772 | print_error_for_call_failure (fns, *args, candidates); |
4773 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4774 | } |
4775 | |
4776 | /* If a cookie is required, add some extra space. Whether |
4777 | or not a cookie is required cannot be determined until |
4778 | after we know which function was called. */ |
4779 | if (*cookie_size) |
4780 | { |
4781 | bool use_cookie = true; |
4782 | tree arg_types; |
4783 | |
4784 | arg_types = TYPE_ARG_TYPES (TREE_TYPE (cand->fn))((tree_check2 ((((contains_struct_check ((cand->fn), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4784, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4784, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values); |
4785 | /* Skip the size_t parameter. */ |
4786 | arg_types = TREE_CHAIN (arg_types)((contains_struct_check ((arg_types), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4786, __FUNCTION__))->common.chain); |
4787 | /* Check the remaining parameters (if any). */ |
4788 | if (arg_types |
4789 | && TREE_CHAIN (arg_types)((contains_struct_check ((arg_types), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4789, __FUNCTION__))->common.chain) == void_list_nodeglobal_trees[TI_VOID_LIST_NODE] |
4790 | && same_type_p (TREE_VALUE (arg_types),comptypes ((((tree_check ((arg_types), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4790, __FUNCTION__, (TREE_LIST)))->list.value)), (global_trees [TI_PTR_TYPE]), 0) |
4791 | ptr_type_node)comptypes ((((tree_check ((arg_types), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4790, __FUNCTION__, (TREE_LIST)))->list.value)), (global_trees [TI_PTR_TYPE]), 0)) |
4792 | use_cookie = false; |
4793 | /* If we need a cookie, adjust the number of bytes allocated. */ |
4794 | if (use_cookie) |
4795 | { |
4796 | /* Update the total size. */ |
4797 | *size = size_binop (PLUS_EXPR, original_size, *cookie_size)size_binop_loc (((location_t) 0), PLUS_EXPR, original_size, * cookie_size); |
4798 | if (size_check) |
4799 | { |
4800 | /* Set to (size_t)-1 if the size check fails. */ |
4801 | gcc_assert (size_check != NULL_TREE)((void)(!(size_check != (tree) __null) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4801, __FUNCTION__), 0 : 0)); |
4802 | *size = fold_build3 (COND_EXPR, sizetype, size_check,fold_build3_loc (((location_t) 0), COND_EXPR, sizetype_tab[(int ) stk_sizetype], size_check, *size, ((tree_check5 ((sizetype_tab [(int) stk_sizetype]), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4803, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ) ) |
4803 | *size, TYPE_MAX_VALUE (sizetype))fold_build3_loc (((location_t) 0), COND_EXPR, sizetype_tab[(int ) stk_sizetype], size_check, *size, ((tree_check5 ((sizetype_tab [(int) stk_sizetype]), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4803, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ) ); |
4804 | } |
4805 | /* Update the argument list to reflect the adjusted size. */ |
4806 | (**args)[0] = *size; |
4807 | } |
4808 | else |
4809 | *cookie_size = NULL_TREE(tree) __null; |
4810 | } |
4811 | |
4812 | /* Tell our caller which function we decided to call. */ |
4813 | if (fn) |
4814 | *fn = cand->fn; |
4815 | |
4816 | /* Build the CALL_EXPR. */ |
4817 | tree ret = build_over_call (cand, LOOKUP_NORMAL((1 << 0)), complain); |
4818 | |
4819 | /* Set this flag for all callers of this function. In addition to |
4820 | new-expressions, this is called for allocating coroutine state; treat |
4821 | that as an implicit new-expression. */ |
4822 | tree call = extract_call_expr (ret); |
4823 | if (TREE_CODE (call)((enum tree_code) (call)->base.code) == CALL_EXPR) |
4824 | CALL_FROM_NEW_OR_DELETE_P (call)((tree_check ((call), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4824, __FUNCTION__, (CALL_EXPR)))->base.protected_flag) = 1; |
4825 | |
4826 | return ret; |
4827 | } |
4828 | |
4829 | /* Build a new call to operator(). This may change ARGS. */ |
4830 | |
4831 | static tree |
4832 | build_op_call_1 (tree obj, vec<tree, va_gc> **args, tsubst_flags_t complain) |
4833 | { |
4834 | struct z_candidate *candidates = 0, *cand; |
4835 | tree fns, convs, first_mem_arg = NULL_TREE(tree) __null; |
4836 | bool any_viable_p; |
4837 | tree result = NULL_TREE(tree) __null; |
4838 | void *p; |
4839 | |
4840 | obj = mark_lvalue_use (obj); |
4841 | |
4842 | if (error_operand_p (obj)((obj) == global_trees[TI_ERROR_MARK] || ((obj) && (( contains_struct_check (((obj)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4842, __FUNCTION__))->typed.type) == global_trees[TI_ERROR_MARK ]))) |
4843 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4844 | |
4845 | tree type = TREE_TYPE (obj)((contains_struct_check ((obj), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4845, __FUNCTION__))->typed.type); |
4846 | |
4847 | obj = prep_operand (obj); |
4848 | |
4849 | if (TYPE_PTRMEMFUNC_P (type)(((enum tree_code) (type)->base.code) == RECORD_TYPE && (((tree_class_check (((tree_check ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4849, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4849, __FUNCTION__))->type_common.lang_flag_2)))) |
4850 | { |
4851 | if (complain & tf_error) |
4852 | /* It's no good looking for an overloaded operator() on a |
4853 | pointer-to-member-function. */ |
4854 | error ("pointer-to-member function %qE cannot be called without " |
4855 | "an object; consider using %<.*%> or %<->*%>", obj); |
4856 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4857 | } |
4858 | |
4859 | if (TYPE_BINFO (type)((tree_check3 ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4859, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.maxval)) |
4860 | { |
4861 | fns = lookup_fnfields (TYPE_BINFO (type)((tree_check3 ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4861, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.maxval), call_op_identifier(ovl_op_info[false][OVL_OP_CALL_EXPR].identifier), 1, complain); |
4862 | if (fns == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
4863 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4864 | } |
4865 | else |
4866 | fns = NULL_TREE(tree) __null; |
4867 | |
4868 | if (args != NULL__null && *args != NULL__null) |
4869 | { |
4870 | *args = resolve_args (*args, complain); |
4871 | if (*args == NULL__null) |
4872 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4873 | } |
4874 | |
4875 | /* Get the high-water mark for the CONVERSION_OBSTACK. */ |
4876 | p = conversion_obstack_alloc (0); |
4877 | |
4878 | if (fns) |
4879 | { |
4880 | first_mem_arg = obj; |
4881 | |
4882 | add_candidates (BASELINK_FUNCTIONS (fns)(((struct tree_baselink*) (tree_check ((fns), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4882, __FUNCTION__, (BASELINK))))->functions), |
4883 | first_mem_arg, *args, NULL_TREE(tree) __null, |
4884 | NULL_TREE(tree) __null, false, |
4885 | BASELINK_BINFO (fns)(((struct tree_baselink*) (tree_check ((fns), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4885, __FUNCTION__, (BASELINK))))->binfo), BASELINK_ACCESS_BINFO (fns)(((struct tree_baselink*) (tree_check ((fns), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4885, __FUNCTION__, (BASELINK))))->access_binfo), |
4886 | LOOKUP_NORMAL((1 << 0)), &candidates, complain); |
4887 | } |
4888 | |
4889 | convs = lookup_conversions (type); |
4890 | |
4891 | for (; convs; convs = TREE_CHAIN (convs)((contains_struct_check ((convs), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4891, __FUNCTION__))->common.chain)) |
4892 | { |
4893 | tree totype = TREE_TYPE (convs)((contains_struct_check ((convs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4893, __FUNCTION__))->typed.type); |
4894 | |
4895 | if (TYPE_PTRFN_P (totype)((((enum tree_code) (totype)->base.code) == POINTER_TYPE) && ((enum tree_code) (((contains_struct_check ((totype), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4895, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE ) |
4896 | || TYPE_REFFN_P (totype)((((enum tree_code) (totype)->base.code) == REFERENCE_TYPE ) && ((enum tree_code) (((contains_struct_check ((totype ), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4896, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE ) |
4897 | || (TYPE_REF_P (totype)(((enum tree_code) (totype)->base.code) == REFERENCE_TYPE) |
4898 | && TYPE_PTRFN_P (TREE_TYPE (totype))((((enum tree_code) (((contains_struct_check ((totype), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4898, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE ) && ((enum tree_code) (((contains_struct_check ((((contains_struct_check ((totype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4898, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4898, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE ))) |
4899 | for (ovl_iterator iter (TREE_VALUE (convs)((tree_check ((convs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4899, __FUNCTION__, (TREE_LIST)))->list.value)); iter; ++iter) |
4900 | { |
4901 | tree fn = *iter; |
4902 | |
4903 | if (DECL_NONCONVERTING_P (fn)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? ( (struct tree_template_decl *)(const_cast<union tree_node * > ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4903, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn) ), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4903, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) (fn)->base.code) == FUNCTION_DECL || ((( enum tree_code) (fn)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4903, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4903, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4903, __FUNCTION__); <->u.fn; })->nonconverting )) |
4904 | continue; |
4905 | |
4906 | if (TREE_CODE (fn)((enum tree_code) (fn)->base.code) == TEMPLATE_DECL) |
4907 | add_template_conv_candidate |
4908 | (&candidates, fn, obj, *args, totype, |
4909 | /*access_path=*/NULL_TREE(tree) __null, |
4910 | /*conversion_path=*/NULL_TREE(tree) __null, complain); |
4911 | else |
4912 | add_conv_candidate (&candidates, fn, obj, |
4913 | *args, /*conversion_path=*/NULL_TREE(tree) __null, |
4914 | /*access_path=*/NULL_TREE(tree) __null, complain); |
4915 | } |
4916 | } |
4917 | |
4918 | /* Be strict here because if we choose a bad conversion candidate, the |
4919 | errors we get won't mention the call context. */ |
4920 | candidates = splice_viable (candidates, true, &any_viable_p); |
4921 | if (!any_viable_p) |
4922 | { |
4923 | if (complain & tf_error) |
4924 | { |
4925 | auto_diagnostic_group d; |
4926 | error ("no match for call to %<(%T) (%A)%>", TREE_TYPE (obj)((contains_struct_check ((obj), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4926, __FUNCTION__))->typed.type), |
4927 | build_tree_list_vec (*args)); |
4928 | print_z_candidates (location_of (TREE_TYPE (obj)((contains_struct_check ((obj), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4928, __FUNCTION__))->typed.type)), candidates); |
4929 | } |
4930 | result = error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4931 | } |
4932 | else |
4933 | { |
4934 | cand = tourney (candidates, complain); |
4935 | if (cand == 0) |
4936 | { |
4937 | if (complain & tf_error) |
4938 | { |
4939 | auto_diagnostic_group d; |
4940 | error ("call of %<(%T) (%A)%> is ambiguous", |
4941 | TREE_TYPE (obj)((contains_struct_check ((obj), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4941, __FUNCTION__))->typed.type), build_tree_list_vec (*args)); |
4942 | print_z_candidates (location_of (TREE_TYPE (obj)((contains_struct_check ((obj), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4942, __FUNCTION__))->typed.type)), candidates); |
4943 | } |
4944 | result = error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
4945 | } |
4946 | else if (TREE_CODE (cand->fn)((enum tree_code) (cand->fn)->base.code) == FUNCTION_DECL |
4947 | && DECL_OVERLOADED_OPERATOR_P (cand->fn)(((tree_not_check2 (((tree_check ((((contains_struct_check (( cand->fn), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4947, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4947, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4947, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_2)) |
4948 | && DECL_OVERLOADED_OPERATOR_IS (cand->fn, CALL_EXPR)((__extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (cand->fn)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((cand->fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4948, __FUNCTION__, (TEMPLATE_DECL))))))))->result : cand ->fn)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4948, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) (cand->fn)->base.code) == FUNCTION_DECL || (((enum tree_code) (cand->fn)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((cand->fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4948, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((cand ->fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4948, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4948, __FUNCTION__); <->u.fn; })->ovl_op_code) == OVL_OP_CALL_EXPR)) |
4949 | result = build_over_call (cand, LOOKUP_NORMAL((1 << 0)), complain); |
4950 | else |
4951 | { |
4952 | if (TREE_CODE (cand->fn)((enum tree_code) (cand->fn)->base.code) == FUNCTION_DECL) |
4953 | obj = convert_like_with_context (cand->convs[0], obj, cand->fn, |
4954 | -1, complain); |
4955 | else |
4956 | { |
4957 | gcc_checking_assert (TYPE_P (cand->fn))((void)(!((tree_code_type[(int) (((enum tree_code) (cand-> fn)->base.code))] == tcc_type)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 4957, __FUNCTION__), 0 : 0)); |
4958 | obj = convert_like (cand->convs[0], obj, complain); |
4959 | } |
4960 | obj = convert_from_reference (obj); |
4961 | result = cp_build_function_call_vec (obj, args, complain); |
4962 | } |
4963 | } |
4964 | |
4965 | /* Free all the conversions we allocated. */ |
4966 | obstack_free (&conversion_obstack, p)__extension__ ({ struct obstack *__o = (&conversion_obstack ); void *__obj = (void *) (p); if (__obj > (void *) __o-> chunk && __obj < (void *) __o->chunk_limit) __o ->next_free = __o->object_base = (char *) __obj; else _obstack_free (__o, __obj); }); |
4967 | |
4968 | return result; |
4969 | } |
4970 | |
4971 | /* Wrapper for above. */ |
4972 | |
4973 | tree |
4974 | build_op_call (tree obj, vec<tree, va_gc> **args, tsubst_flags_t complain) |
4975 | { |
4976 | tree ret; |
4977 | bool subtime = timevar_cond_start (TV_OVERLOAD); |
4978 | ret = build_op_call_1 (obj, args, complain); |
4979 | timevar_cond_stop (TV_OVERLOAD, subtime); |
4980 | return ret; |
4981 | } |
4982 | |
4983 | /* Called by op_error to prepare format strings suitable for the error |
4984 | function. It concatenates a prefix (controlled by MATCH), ERRMSG, |
4985 | and a suffix (controlled by NTYPES). */ |
4986 | |
4987 | static const char * |
4988 | op_error_string (const char *errmsg, int ntypes, bool match) |
4989 | { |
4990 | const char *msg; |
4991 | |
4992 | const char *msgp = concat (match ? G_("ambiguous overload for ")"ambiguous overload for " |
4993 | : G_("no match for ")"no match for ", errmsg, NULL__null); |
4994 | |
4995 | if (ntypes == 3) |
4996 | msg = concat (msgp, G_(" (operand types are %qT, %qT, and %qT)")" (operand types are %qT, %qT, and %qT)", NULL__null); |
4997 | else if (ntypes == 2) |
4998 | msg = concat (msgp, G_(" (operand types are %qT and %qT)")" (operand types are %qT and %qT)", NULL__null); |
4999 | else |
5000 | msg = concat (msgp, G_(" (operand type is %qT)")" (operand type is %qT)", NULL__null); |
5001 | |
5002 | return msg; |
5003 | } |
5004 | |
5005 | static void |
5006 | op_error (const op_location_t &loc, |
5007 | enum tree_code code, enum tree_code code2, |
5008 | tree arg1, tree arg2, tree arg3, bool match) |
5009 | { |
5010 | bool assop = code == MODIFY_EXPR; |
5011 | const char *opname = OVL_OP_INFO (assop, assop ? code2 : code)(&ovl_op_info[(assop) != 0][ovl_op_mapping[(assop ? code2 : code)]])->name; |
5012 | |
5013 | switch (code) |
5014 | { |
5015 | case COND_EXPR: |
5016 | if (flag_diagnostics_show_caretglobal_options.x_flag_diagnostics_show_caret) |
5017 | error_at (loc, op_error_string (G_("ternary %<operator?:%>")"ternary %<operator?:%>", |
5018 | 3, match), |
5019 | TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 5019, __FUNCTION__))->typed.type), TREE_TYPE (arg2)((contains_struct_check ((arg2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 5019, __FUNCTION__))->typed.type), TREE_TYPE (arg3)((contains_struct_check ((arg3), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 5019, __FUNCTION__))->typed.type)); |
5020 | else |
5021 | error_at (loc, op_error_string (G_("ternary %<operator?:%> ""ternary %<operator?:%> " "in %<%E ? %E : %E%>" |
5022 | "in %<%E ? %E : %E%>")"ternary %<operator?:%> " "in %<%E ? %E : %E%>", 3, match), |
5023 | arg1, arg2, arg3, |
5024 | TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 5024, __FUNCTION__))->typed.type), TREE_TYPE (arg2)((contains_struct_check ((arg2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 5024, __FUNCTION__))->typed.type), TREE_TYPE (arg3)((contains_struct_check ((arg3), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 5024, __FUNCTION__))->typed.type)); |
5025 | break; |
5026 | |
5027 | case POSTINCREMENT_EXPR: |
5028 | case POSTDECREMENT_EXPR: |
5029 | if (flag_diagnostics_show_caretglobal_options.x_flag_diagnostics_show_caret) |
5030 | error_at (loc, op_error_string (G_("%<operator%s%>")"%<operator%s%>", 1, match), |
5031 | opname, TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 5031, __FUNCTION__))->typed.type)); |
5032 | else |
5033 | error_at (loc, op_error_string (G_("%<operator%s%> in %<%E%s%>")"%<operator%s%> in %<%E%s%>", |
5034 | 1, match), |
5035 | opname, arg1, opname, TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 5035, __FUNCTION__))->typed.type)); |
5036 | break; |
5037 | |
5038 | case ARRAY_REF: |
5039 | if (flag_diagnostics_show_caretglobal_options.x_flag_diagnostics_show_caret) |
5040 | error_at (loc, op_error_string (G_("%<operator[]%>")"%<operator[]%>", 2, match), |
5041 | TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 5041, __FUNCTION__))->typed.type), TREE_TYPE (arg2)((contains_struct_check ((arg2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 5041, __FUNCTION__))->typed.type)); |
5042 | else |
5043 | error_at (loc, op_error_string (G_("%<operator[]%> in %<%E[%E]%>")"%<operator[]%> in %<%E[%E]%>", |
5044 | 2, match), |
5045 | arg1, arg2, TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 5045, __FUNCTION__))->typed.type), TREE_TYPE (arg2)((contains_struct_check ((arg2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 5045, __FUNCTION__))->typed.type)); |
5046 | break; |
5047 | |
5048 | case REALPART_EXPR: |
5049 | case IMAGPART_EXPR: |
5050 | if (flag_diagnostics_show_caretglobal_options.x_flag_diagnostics_show_caret) |
5051 | error_at (loc, op_error_string (G_("%qs")"%qs", 1, match), |
5052 | opname, TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 5052, __FUNCTION__))->typed.type)); |
5053 | else |
5054 | error_at (loc, op_error_string (G_("%qs in %<%s %E%>")"%qs in %<%s %E%>", 1, match), |
5055 | opname, opname, arg1, TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c" , 5055, __FUNCTION__))->typed.type)); |
5056 | break; |
5057 | |
5058 | case CO_AWAIT_EXPR: |
5059 | if (flag_diagnostics_show_caretglobal_options.x_flag_diagnostics_show_caret) |