Bug Summary

File:build/gcc/cp/call.cc
Warning:line 7314, column 5
Value stored to 'arg3' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-suse-linux -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name call.cc -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model static -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/buildworker/marxinbox-gcc-clang-static-analyzer/objdir/gcc -resource-dir /usr/lib64/clang/15.0.7 -D IN_GCC_FRONTEND -D IN_GCC -D HAVE_CONFIG_H -I . -I cp -I /buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc -I /buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp -I /buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../include -I /buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libcpp/include -I /buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libcody -I /buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libdecnumber -I /buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libdecnumber/bid -I ../libdecnumber -I /buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libbacktrace -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/13/../../../../include/c++/13 -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/13/../../../../include/c++/13/x86_64-suse-linux -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/13/../../../../include/c++/13/backward -internal-isystem /usr/lib64/clang/15.0.7/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-narrowing -Wwrite-strings -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fdeprecated-macro -fdebug-compilation-dir=/buildworker/marxinbox-gcc-clang-static-analyzer/objdir/gcc -ferror-limit 19 -fno-rtti -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-output=plist-html -analyzer-config silence-checkers=core.NullDereference -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /buildworker/marxinbox-gcc-clang-static-analyzer/objdir/clang-static-analyzer/2023-03-27-141847-20772-1/report-HZGD6k.plist -x c++ /buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc
1/* Functions related to invoking -*- C++ -*- methods and overloaded functions.
2 Copyright (C) 1987-2023 Free Software Foundation, Inc.
3 Contributed by Michael Tiemann (tiemann@cygnus.com) and
4 modified by Brendan Kehoe (brendan@cygnus.com).
5
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 3, or (at your option)
11any later version.
12
13GCC is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along 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 "decl.h"
45#include "gcc-rich-location.h"
46
47/* The various kinds of conversion. */
48
49enum conversion_kind {
50 ck_identity,
51 ck_lvalue,
52 ck_fnptr,
53 ck_qual,
54 ck_std,
55 ck_ptr,
56 ck_pmem,
57 ck_base,
58 ck_ref_bind,
59 ck_user,
60 ck_ambig,
61 ck_list,
62 ck_aggr,
63 ck_rvalue,
64 /* When LOOKUP_SHORTCUT_BAD_CONVS is set, we may return a conversion of
65 this kind whenever we know the true conversion is either bad or outright
66 invalid, but we don't want to attempt to compute the bad conversion (for
67 sake of avoiding unnecessary instantiation). bad_p should always be set
68 for these. */
69 ck_deferred_bad,
70};
71
72/* The rank of the conversion. Order of the enumerals matters; better
73 conversions should come earlier in the list. */
74
75enum conversion_rank {
76 cr_identity,
77 cr_exact,
78 cr_promotion,
79 cr_std,
80 cr_pbool,
81 cr_user,
82 cr_ellipsis,
83 cr_bad
84};
85
86/* An implicit conversion sequence, in the sense of [over.best.ics].
87 The first conversion to be performed is at the end of the chain.
88 That conversion is always a cr_identity conversion. */
89
90struct conversion {
91 /* The kind of conversion represented by this step. */
92 conversion_kind kind;
93 /* The rank of this conversion. */
94 conversion_rank rank;
95 BOOL_BITFIELDunsigned int user_conv_p : 1;
96 BOOL_BITFIELDunsigned int ellipsis_p : 1;
97 BOOL_BITFIELDunsigned int this_p : 1;
98 /* True if this conversion would be permitted with a bending of
99 language standards, e.g. disregarding pointer qualifiers or
100 converting integers to pointers. */
101 BOOL_BITFIELDunsigned int bad_p : 1;
102 /* If KIND is ck_ref_bind or ck_base, true to indicate that a
103 temporary should be created to hold the result of the
104 conversion. If KIND is ck_ambig or ck_user, true means force
105 copy-initialization. */
106 BOOL_BITFIELDunsigned int need_temporary_p : 1;
107 /* If KIND is ck_ptr or ck_pmem, true to indicate that a conversion
108 from a pointer-to-derived to pointer-to-base is being performed. */
109 BOOL_BITFIELDunsigned int base_p : 1;
110 /* If KIND is ck_ref_bind, true when either an lvalue reference is
111 being bound to an lvalue expression or an rvalue reference is
112 being bound to an rvalue expression. If KIND is ck_rvalue or ck_base,
113 true when we are treating an lvalue as an rvalue (12.8p33). If
114 ck_identity, we will be binding a reference directly or decaying to
115 a pointer. */
116 BOOL_BITFIELDunsigned int rvaluedness_matches_p: 1;
117 BOOL_BITFIELDunsigned int check_narrowing: 1;
118 /* Whether check_narrowing should only check TREE_CONSTANTs; used
119 in build_converted_constant_expr. */
120 BOOL_BITFIELDunsigned int check_narrowing_const_only: 1;
121 /* True if this conversion is taking place in a copy-initialization context
122 and we should only consider converting constructors. Only set in
123 ck_base and ck_rvalue. */
124 BOOL_BITFIELDunsigned int copy_init_p : 1;
125 /* The type of the expression resulting from the conversion. */
126 tree type;
127 union {
128 /* The next conversion in the chain. Since the conversions are
129 arranged from outermost to innermost, the NEXT conversion will
130 actually be performed before this conversion. This variant is
131 used only when KIND is neither ck_identity, ck_aggr, ck_ambig nor
132 ck_list. Please use the next_conversion function instead
133 of using this field directly. */
134 conversion *next;
135 /* The expression at the beginning of the conversion chain. This
136 variant is used only if KIND is ck_identity, ck_aggr, or ck_ambig.
137 You can use conv_get_original_expr to get this expression. */
138 tree expr;
139 /* The array of conversions for an initializer_list, so this
140 variant is used only when KIN D is ck_list. */
141 conversion **list;
142 } u;
143 /* The function candidate corresponding to this conversion
144 sequence. This field is only used if KIND is ck_user. */
145 struct z_candidate *cand;
146};
147
148#define CONVERSION_RANK(NODE)((NODE)->bad_p ? cr_bad : (NODE)->ellipsis_p ? cr_ellipsis
: (NODE)->user_conv_p ? cr_user : (NODE)->rank)
\
149 ((NODE)->bad_p ? cr_bad \
150 : (NODE)->ellipsis_p ? cr_ellipsis \
151 : (NODE)->user_conv_p ? cr_user \
152 : (NODE)->rank)
153
154#define BAD_CONVERSION_RANK(NODE)((NODE)->ellipsis_p ? cr_ellipsis : (NODE)->user_conv_p
? cr_user : (NODE)->rank)
\
155 ((NODE)->ellipsis_p ? cr_ellipsis \
156 : (NODE)->user_conv_p ? cr_user \
157 : (NODE)->rank)
158
159static struct obstack conversion_obstack;
160static bool conversion_obstack_initialized;
161struct rejection_reason;
162
163static struct z_candidate * tourney (struct z_candidate *, tsubst_flags_t);
164static int equal_functions (tree, tree);
165static int joust (struct z_candidate *, struct z_candidate *, bool,
166 tsubst_flags_t);
167static int compare_ics (conversion *, conversion *);
168static void maybe_warn_class_memaccess (location_t, tree,
169 const vec<tree, va_gc> *);
170static tree build_over_call (struct z_candidate *, int, tsubst_flags_t);
171static tree convert_like (conversion *, tree, tsubst_flags_t);
172static tree convert_like_with_context (conversion *, tree, tree, int,
173 tsubst_flags_t);
174static void op_error (const op_location_t &, enum tree_code, enum tree_code,
175 tree, tree, tree, bool);
176static struct z_candidate *build_user_type_conversion_1 (tree, tree, int,
177 tsubst_flags_t);
178static void print_z_candidate (location_t, const char *, struct z_candidate *);
179static void print_z_candidates (location_t, struct z_candidate *);
180static tree build_this (tree);
181static struct z_candidate *splice_viable (struct z_candidate *, bool, bool *);
182static bool any_strictly_viable (struct z_candidate *);
183static struct z_candidate *add_template_candidate
184 (struct z_candidate **, tree, tree, tree, tree, const vec<tree, va_gc> *,
185 tree, tree, tree, int, unification_kind_t, bool, tsubst_flags_t);
186static struct z_candidate *add_template_candidate_real
187 (struct z_candidate **, tree, tree, tree, tree, const vec<tree, va_gc> *,
188 tree, tree, tree, int, tree, unification_kind_t, bool, tsubst_flags_t);
189static bool is_complete (tree);
190static struct z_candidate *add_conv_candidate
191 (struct z_candidate **, tree, tree, const vec<tree, va_gc> *, tree,
192 tree, tsubst_flags_t);
193static struct z_candidate *add_function_candidate
194 (struct z_candidate **, tree, tree, tree, const vec<tree, va_gc> *, tree,
195 tree, int, conversion**, bool, tsubst_flags_t);
196static conversion *implicit_conversion (tree, tree, tree, bool, int,
197 tsubst_flags_t);
198static conversion *reference_binding (tree, tree, tree, bool, int,
199 tsubst_flags_t);
200static conversion *build_conv (conversion_kind, tree, conversion *);
201static conversion *build_list_conv (tree, tree, int, tsubst_flags_t);
202static conversion *next_conversion (conversion *);
203static bool is_subseq (conversion *, conversion *);
204static conversion *maybe_handle_ref_bind (conversion **);
205static void maybe_handle_implicit_object (conversion **);
206static struct z_candidate *add_candidate
207 (struct z_candidate **, tree, tree, const vec<tree, va_gc> *, size_t,
208 conversion **, tree, tree, int, struct rejection_reason *, int);
209static tree source_type (conversion *);
210static void add_warning (struct z_candidate *, struct z_candidate *);
211static conversion *direct_reference_binding (tree, conversion *);
212static bool promoted_arithmetic_type_p (tree);
213static conversion *conditional_conversion (tree, tree, tsubst_flags_t);
214static char *name_as_c_string (tree, tree, bool *);
215static tree prep_operand (tree);
216static void add_candidates (tree, tree, const vec<tree, va_gc> *, tree, tree,
217 bool, tree, tree, int, struct z_candidate **,
218 tsubst_flags_t);
219static conversion *merge_conversion_sequences (conversion *, conversion *);
220static tree build_temp (tree, tree, int, diagnostic_t *, tsubst_flags_t);
221static conversion *build_identity_conv (tree, tree);
222static inline bool conv_binds_to_array_of_unknown_bound (conversion *);
223static bool conv_is_prvalue (conversion *);
224static tree prevent_lifetime_extension (tree);
225
226/* Returns nonzero iff the destructor name specified in NAME matches BASETYPE.
227 NAME can take many forms... */
228
229bool
230check_dtor_name (tree basetype, tree name)
231{
232 /* Just accept something we've already complained about. */
233 if (name == error_mark_nodeglobal_trees[TI_ERROR_MARK])
234 return true;
235
236 if (TREE_CODE (name)((enum tree_code) (name)->base.code) == TYPE_DECL)
237 name = TREE_TYPE (name)((contains_struct_check ((name), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 237, __FUNCTION__))->typed.type)
;
238 else if (TYPE_P (name)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code
) (name)->base.code))] == tcc_type)
)
239 /* OK */;
240 else if (identifier_p (name))
241 {
242 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) == TRAIT_TYPE
|| ((enum tree_code) (basetype)->base.code) == DEPENDENT_OPERATOR_TYPE
) || (((((enum tree_code) (basetype)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (basetype)->base.code)) == UNION_TYPE
) && ((tree_class_check ((basetype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 242, __FUNCTION__))->type_common.lang_flag_5)))
243 || TREE_CODE (basetype)((enum tree_code) (basetype)->base.code) == ENUMERAL_TYPE)
244 && name == constructor_name (basetype))
245 return true;
246
247 /* Otherwise lookup the name, it could be an unrelated typedef
248 of the correct type. */
249 name = lookup_name (name, LOOK_want::TYPE);
250 if (!name)
251 return false;
252 name = TREE_TYPE (name)((contains_struct_check ((name), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 252, __FUNCTION__))->typed.type)
;
253 if (name == error_mark_nodeglobal_trees[TI_ERROR_MARK])
254 return false;
255 }
256 else
257 {
258 /* In the case of:
259
260 template <class T> struct S { ~S(); };
261 int i;
262 i.~S();
263
264 NAME will be a class template. */
265 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 265, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((name
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 265, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base
.code) == TYPE_DECL) && (((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((name
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 265, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base
.code) == TYPE_DECL && ((contains_struct_check ((((struct
tree_template_decl *)(const_cast<union tree_node *> ((
((tree_check ((name), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 265, __FUNCTION__, (TEMPLATE_DECL))))))))->result), (TS_DECL_COMMON
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 265, __FUNCTION__))->decl_common.lang_flag_2)))) ? fancy_abort
("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 265, __FUNCTION__), 0 : 0))
;
266 return false;
267 }
268
269 return same_type_p (TYPE_MAIN_VARIANT (basetype), TYPE_MAIN_VARIANT (name))comptypes ((((tree_class_check ((basetype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 269, __FUNCTION__))->type_common.main_variant)), (((tree_class_check
((name), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 269, __FUNCTION__))->type_common.main_variant)), 0)
;
270}
271
272/* We want the address of a function or method. We avoid creating a
273 pointer-to-member function. */
274
275tree
276build_addr_func (tree function, tsubst_flags_t complain)
277{
278 tree type = TREE_TYPE (function)((contains_struct_check ((function), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 278, __FUNCTION__))->typed.type)
;
279
280 /* We have to do these by hand to avoid real pointer to member
281 functions. */
282 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == METHOD_TYPE)
283 {
284 if (TREE_CODE (function)((enum tree_code) (function)->base.code) == OFFSET_REF)
285 {
286 tree object = build_address (TREE_OPERAND (function, 0)(*((const_cast<tree*> (tree_operand_check ((function), (
0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 286, __FUNCTION__)))))
);
287 return get_member_function_from_ptrfunc (&object,
288 TREE_OPERAND (function, 1)(*((const_cast<tree*> (tree_operand_check ((function), (
1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 288, __FUNCTION__)))))
,
289 complain);
290 }
291 function = build_address (function);
292 }
293 else if (TREE_CODE (function)((enum tree_code) (function)->base.code) == FUNCTION_DECL
294 && 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
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 294, __FUNCTION__, (TEMPLATE_DECL))))))))->result : function
)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 294, __FUNCTION__, (FUNCTION_DECL)))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 294, __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
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 294, __FUNCTION__, (TEMPLATE_DECL))))))))->result : function
)), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 294, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 294, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((function
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 294, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base
.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 294, __FUNCTION__); &lt->u.fn; })->immediate_fn_p
: false)
)
295 function = build_address (function);
296 else
297 function = decay_conversion (function, complain, /*reject_builtin=*/false);
298
299 return function;
300}
301
302/* Build a CALL_EXPR, we can handle FUNCTION_TYPEs, METHOD_TYPEs, or
303 POINTER_TYPE to those. Note, pointer to member function types
304 (TYPE_PTRMEMFUNC_P) must be handled by our callers. There are
305 two variants. build_call_a is the primitive taking an array of
306 arguments, while build_call_n is a wrapper that handles varargs. */
307
308tree
309build_call_n (tree function, int n, ...)
310{
311 if (n == 0)
312 return build_call_a (function, 0, NULL__null);
313 else
314 {
315 tree *argarray = XALLOCAVEC (tree, n)((tree *) __builtin_alloca(sizeof (tree) * (n)));
316 va_list ap;
317 int i;
318
319 va_start (ap, n)__builtin_va_start(ap, n);
320 for (i = 0; i < n; i++)
321 argarray[i] = va_arg (ap, tree)__builtin_va_arg(ap, tree);
322 va_end (ap)__builtin_va_end(ap);
323 return build_call_a (function, n, argarray);
324 }
325}
326
327/* Update various flags in cfun and the call itself based on what is being
328 called. Split out of build_call_a so that bot_manip can use it too. */
329
330void
331set_flags_from_callee (tree call)
332{
333 /* Handle both CALL_EXPRs and AGGR_INIT_EXPRs. */
334 tree decl = cp_get_callee_fndecl_nofold (call);
335
336 /* We check both the decl and the type; a function may be known not to
337 throw without being declared throw(). */
338 bool nothrow = decl && TREE_NOTHROW (decl)((decl)->base.nothrow_flag);
339 tree callee = cp_get_callee (call);
340 if (callee)
341 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 341, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 341, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 341, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))), (tcc_type
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 341, __FUNCTION__))->type_non_common.lang_1))
;
342 else if (TREE_CODE (call)((enum tree_code) (call)->base.code) == CALL_EXPR
343 && internal_fn_flags (CALL_EXPR_IFN (call)((tree_check ((call), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 343, __FUNCTION__, (CALL_EXPR)))->base.u.ifn)
) & ECF_NOTHROW(1 << 6))
344 nothrow = true;
345
346 if (cfun(cfun + 0) && cp_function_chain((cfun + 0)->language) && !cp_unevaluated_operand)
347 {
348 if (!nothrow && at_function_scope_p ())
349 cp_function_chain((cfun + 0)->language)->can_throw = 1;
350
351 if (decl && TREE_THIS_VOLATILE (decl)((decl)->base.volatile_flag))
352 current_function_returns_abnormally((cfun + 0)->language)->returns_abnormally = 1;
353 }
354
355 TREE_NOTHROW (call)((call)->base.nothrow_flag) = nothrow;
356}
357
358tree
359build_call_a (tree function, int n, tree *argarray)
360{
361 tree decl;
362 tree result_type;
363 tree fntype;
364 int i;
365
366 function = build_addr_func (function, tf_warning_or_error);
367
368 gcc_assert (TYPE_PTR_P (TREE_TYPE (function)))((void)(!((((enum tree_code) (((contains_struct_check ((function
), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 368, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE
)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 368, __FUNCTION__), 0 : 0))
;
369 fntype = TREE_TYPE (TREE_TYPE (function))((contains_struct_check ((((contains_struct_check ((function)
, (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 369, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 369, __FUNCTION__))->typed.type)
;
370 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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 370, __FUNCTION__), 0 : 0))
;
371 result_type = TREE_TYPE (fntype)((contains_struct_check ((fntype), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 371, __FUNCTION__))->typed.type)
;
372 /* An rvalue has no cv-qualifiers. */
373 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),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 373, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 373, __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))
374 result_type = cv_unqualified (result_type);
375
376 function = build_call_array_loc (input_location,
377 result_type, function, n, argarray);
378 set_flags_from_callee (function);
379
380 decl = get_callee_fndecl (function);
381
382 if (decl && !TREE_USED (decl)((decl)->base.used_flag))
383 {
384 /* We invoke build_call directly for several library
385 functions. These may have been declared normally if
386 we're building libgcc, so we can't just check
387 DECL_ARTIFICIAL. */
388 gcc_assert (DECL_ARTIFICIAL (decl)((void)(!(((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 388, __FUNCTION__))->decl_common.artificial_flag) || !strncmp
(((const char *) (tree_check ((((contains_struct_check ((decl
), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 389, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 389, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str
), "__", 2)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 390, __FUNCTION__), 0 : 0))
389 || !strncmp (IDENTIFIER_POINTER (DECL_NAME (decl)),((void)(!(((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 388, __FUNCTION__))->decl_common.artificial_flag) || !strncmp
(((const char *) (tree_check ((((contains_struct_check ((decl
), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 389, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 389, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str
), "__", 2)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 390, __FUNCTION__), 0 : 0))
390 "__", 2))((void)(!(((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 388, __FUNCTION__))->decl_common.artificial_flag) || !strncmp
(((const char *) (tree_check ((((contains_struct_check ((decl
), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 389, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 389, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str
), "__", 2)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 390, __FUNCTION__), 0 : 0))
;
391 mark_used (decl);
392 }
393
394 require_complete_eh_spec_types (fntype, decl);
395
396 TREE_HAS_CONSTRUCTOR (function)(((tree_not_check2 ((function), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 396, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 396, __FUNCTION__, (TEMPLATE_DECL))))))))->result : decl
)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 396, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
);
397
398 /* Don't pass empty class objects by value. This is useful
399 for tags in STL, which are used to control overload resolution.
400 We don't need to handle other cases of copying empty classes. */
401 if (!decl || !fndecl_built_in_p (decl))
402 for (i = 0; i < n; i++)
403 {
404 tree arg = CALL_EXPR_ARG (function, i)(*((const_cast<tree*> (tree_operand_check (((tree_check
((function), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 404, __FUNCTION__, (CALL_EXPR)))), ((i) + 3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 404, __FUNCTION__)))))
;
405 if (is_empty_class (TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 405, __FUNCTION__))->typed.type)
)
406 && simple_empty_class_p (TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 406, __FUNCTION__))->typed.type)
, arg, INIT_EXPR))
407 {
408 while (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == TARGET_EXPR)
409 /* We're disconnecting the initializer from its target,
410 don't create a temporary. */
411 arg = TARGET_EXPR_INITIAL (arg)(*(tree_operand_check_code ((arg), (TARGET_EXPR), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 411, __FUNCTION__)))
;
412 tree t = build0 (EMPTY_CLASS_EXPR, TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 412, __FUNCTION__))->typed.type)
);
413 arg = build2 (COMPOUND_EXPR, TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 413, __FUNCTION__))->typed.type)
, arg, t);
414 CALL_EXPR_ARG (function, i)(*((const_cast<tree*> (tree_operand_check (((tree_check
((function), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 414, __FUNCTION__, (CALL_EXPR)))), ((i) + 3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 414, __FUNCTION__)))))
= arg;
415 }
416 }
417
418 return function;
419}
420
421/* New overloading code. */
422
423struct z_candidate;
424
425struct candidate_warning {
426 z_candidate *loser;
427 candidate_warning *next;
428};
429
430/* Information for providing diagnostics about why overloading failed. */
431
432enum rejection_reason_code {
433 rr_none,
434 rr_arity,
435 rr_explicit_conversion,
436 rr_template_conversion,
437 rr_arg_conversion,
438 rr_bad_arg_conversion,
439 rr_template_unification,
440 rr_invalid_copy,
441 rr_inherited_ctor,
442 rr_constraint_failure
443};
444
445struct conversion_info {
446 /* The index of the argument, 0-based. */
447 int n_arg;
448 /* The actual argument or its type. */
449 tree from;
450 /* The type of the parameter. */
451 tree to_type;
452 /* The location of the argument. */
453 location_t loc;
454};
455
456struct rejection_reason {
457 enum rejection_reason_code code;
458 union {
459 /* Information about an arity mismatch. */
460 struct {
461 /* The expected number of arguments. */
462 int expected;
463 /* The actual number of arguments in the call. */
464 int actual;
465 /* Whether EXPECTED should be treated as a lower bound. */
466 bool least_p;
467 } arity;
468 /* Information about an argument conversion mismatch. */
469 struct conversion_info conversion;
470 /* Same, but for bad argument conversions. */
471 struct conversion_info bad_conversion;
472 /* Information about template unification failures. These are the
473 parameters passed to fn_type_unification. */
474 struct {
475 tree tmpl;
476 tree explicit_targs;
477 int num_targs;
478 const tree *args;
479 unsigned int nargs;
480 tree return_type;
481 unification_kind_t strict;
482 int flags;
483 } template_unification;
484 /* Information about template instantiation failures. These are the
485 parameters passed to instantiate_template. */
486 struct {
487 tree tmpl;
488 tree targs;
489 } template_instantiation;
490 } u;
491};
492
493struct z_candidate {
494 /* The FUNCTION_DECL that will be called if this candidate is
495 selected by overload resolution. */
496 tree fn;
497 /* If not NULL_TREE, the first argument to use when calling this
498 function. */
499 tree first_arg;
500 /* The rest of the arguments to use when calling this function. If
501 there are no further arguments this may be NULL or it may be an
502 empty vector. */
503 const vec<tree, va_gc> *args;
504 /* The implicit conversion sequences for each of the arguments to
505 FN. */
506 conversion **convs;
507 /* The number of implicit conversion sequences. */
508 size_t num_convs;
509 /* If FN is a user-defined conversion, the standard conversion
510 sequence from the type returned by FN to the desired destination
511 type. */
512 conversion *second_conv;
513 struct rejection_reason *reason;
514 /* If FN is a member function, the binfo indicating the path used to
515 qualify the name of FN at the call site. This path is used to
516 determine whether or not FN is accessible if it is selected by
517 overload resolution. The DECL_CONTEXT of FN will always be a
518 (possibly improper) base of this binfo. */
519 tree access_path;
520 /* If FN is a non-static member function, the binfo indicating the
521 subobject to which the `this' pointer should be converted if FN
522 is selected by overload resolution. The type pointed to by
523 the `this' pointer must correspond to the most derived class
524 indicated by the CONVERSION_PATH. */
525 tree conversion_path;
526 tree template_decl;
527 tree explicit_targs;
528 candidate_warning *warnings;
529 z_candidate *next;
530 int viable;
531
532 /* The flags active in add_candidate. */
533 int flags;
534
535 bool rewritten () const { return (flags & LOOKUP_REWRITTEN(((((((((((((1 << 6) << 1) << 1) << 1
) << 1) << 1) << 1) << 1) << 1)
<< 1) << 1) << 1) << 1)
); }
536 bool reversed () const { return (flags & LOOKUP_REVERSED((((((((((((((1 << 6) << 1) << 1) << 1
) << 1) << 1) << 1) << 1) << 1)
<< 1) << 1) << 1) << 1) << 1)
); }
537};
538
539/* Returns true iff T is a null pointer constant in the sense of
540 [conv.ptr]. */
541
542bool
543null_ptr_cst_p (tree t)
544{
545 tree type = TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 545, __FUNCTION__))->typed.type)
;
546
547 /* [conv.ptr]
548
549 A null pointer constant is an integer literal ([lex.icon]) with value
550 zero or a prvalue of type std::nullptr_t. */
551 if (NULLPTR_TYPE_P (type)(((enum tree_code) (type)->base.code) == NULLPTR_TYPE))
552 return true;
553
554 if (cxx_dialect >= cxx11)
555 {
556 STRIP_ANY_LOCATION_WRAPPER (t)(t) = tree_strip_any_location_wrapper ((const_cast<union tree_node
*> (((t)))))
;
557
558 /* Core issue 903 says only literal 0 is a null pointer constant. */
559 if (TREE_CODE (t)((enum tree_code) (t)->base.code) == INTEGER_CST
560 && !TREE_OVERFLOW (t)((tree_class_check ((t), (tcc_constant), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 560, __FUNCTION__))->base.public_flag)
561 && TREE_CODE (type)((enum tree_code) (type)->base.code) == INTEGER_TYPE
562 && integer_zerop (t)
563 && !char_type_p (type))
564 return true;
565 }
566 else if (CP_INTEGRAL_TYPE_P (type)(((enum tree_code) (type)->base.code) == BOOLEAN_TYPE || (
(enum tree_code) (type)->base.code) == INTEGER_TYPE)
)
567 {
568 t = fold_non_dependent_expr (t, tf_none);
569 STRIP_NOPS (t)(t) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((t)))))
;
570 if (integer_zerop (t) && !TREE_OVERFLOW (t)((tree_class_check ((t), (tcc_constant), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 570, __FUNCTION__))->base.public_flag)
)
571 return true;
572 }
573
574 return false;
575}
576
577/* Returns true iff T is a null member pointer value (4.11). */
578
579bool
580null_member_pointer_value_p (tree t)
581{
582 tree type = TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 582, __FUNCTION__))->typed.type)
;
583 if (!type)
584 return false;
585 else if (TYPE_PTRMEMFUNC_P (type)(((enum tree_code) (type)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 585, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 585, __FUNCTION__))->type_common.lang_flag_2)))
)
586 return (TREE_CODE (t)((enum tree_code) (t)->base.code) == CONSTRUCTOR
587 && CONSTRUCTOR_NELTS (t)(vec_safe_length (((tree_check ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 587, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
588 && integer_zerop (CONSTRUCTOR_ELT (t, 0)(&(*((tree_check ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 588, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[0
])
->value));
589 else if (TYPE_PTRDATAMEM_P (type)(((enum tree_code) (type)->base.code) == OFFSET_TYPE))
590 return integer_all_onesp (t);
591 else
592 return false;
593}
594
595/* Returns nonzero if PARMLIST consists of only default parms,
596 ellipsis, and/or undeduced parameter packs. */
597
598bool
599sufficient_parms_p (const_tree parmlist)
600{
601 for (; parmlist && parmlist != void_list_nodeglobal_trees[TI_VOID_LIST_NODE];
602 parmlist = TREE_CHAIN (parmlist)((contains_struct_check ((parmlist), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 602, __FUNCTION__))->common.chain)
)
603 if (!TREE_PURPOSE (parmlist)((tree_check ((parmlist), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 603, __FUNCTION__, (TREE_LIST)))->list.purpose)
604 && !PACK_EXPANSION_P (TREE_VALUE (parmlist))(((enum tree_code) (((tree_check ((parmlist), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 604, __FUNCTION__, (TREE_LIST)))->list.value))->base.
code) == TYPE_PACK_EXPANSION || ((enum tree_code) (((tree_check
((parmlist), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 604, __FUNCTION__, (TREE_LIST)))->list.value))->base.
code) == EXPR_PACK_EXPANSION)
)
605 return false;
606 return true;
607}
608
609/* Allocate N bytes of memory from the conversion obstack. The memory
610 is zeroed before being returned. */
611
612static void *
613conversion_obstack_alloc (size_t n)
614{
615 void *p;
616 if (!conversion_obstack_initialized)
617 {
618 gcc_obstack_init (&conversion_obstack)_obstack_begin (((&conversion_obstack)), (memory_block_pool
::block_size), (0), (mempool_obstack_chunk_alloc), (mempool_obstack_chunk_free
))
;
619 conversion_obstack_initialized = true;
620 }
621 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) + (((__o1->next_free) - (__o1
->object_base) + (__o1->alignment_mask)) & ~(__o1->
alignment_mask))) : (char *) (((ptrdiff_t) (__o1->next_free
) + (__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; }); })
;
622 memset (p, 0, n);
623 return p;
624}
625
626/* RAII class to discard anything added to conversion_obstack. */
627
628struct conversion_obstack_sentinel
629{
630 void *p;
631 conversion_obstack_sentinel (): p (conversion_obstack_alloc (0)) {}
632 ~conversion_obstack_sentinel () { 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); })
; }
633};
634
635/* Allocate rejection reasons. */
636
637static struct rejection_reason *
638alloc_rejection (enum rejection_reason_code code)
639{
640 struct rejection_reason *p;
641 p = (struct rejection_reason *) conversion_obstack_alloc (sizeof *p);
642 p->code = code;
643 return p;
644}
645
646static struct rejection_reason *
647arity_rejection (tree first_arg, int expected, int actual, bool least_p = false)
648{
649 struct rejection_reason *r = alloc_rejection (rr_arity);
650 int adjust = first_arg != NULL_TREE(tree) __null;
651 r->u.arity.expected = expected - adjust;
652 r->u.arity.actual = actual - adjust;
653 r->u.arity.least_p = least_p;
654 return r;
655}
656
657static struct rejection_reason *
658arg_conversion_rejection (tree first_arg, int n_arg, tree from, tree to,
659 location_t loc)
660{
661 struct rejection_reason *r = alloc_rejection (rr_arg_conversion);
662 int adjust = first_arg != NULL_TREE(tree) __null;
663 r->u.conversion.n_arg = n_arg - adjust;
664 r->u.conversion.from = from;
665 r->u.conversion.to_type = to;
666 r->u.conversion.loc = loc;
667 return r;
668}
669
670static struct rejection_reason *
671bad_arg_conversion_rejection (tree first_arg, int n_arg, tree from, tree to,
672 location_t loc)
673{
674 struct rejection_reason *r = alloc_rejection (rr_bad_arg_conversion);
675 int adjust = first_arg != NULL_TREE(tree) __null;
676 r->u.bad_conversion.n_arg = n_arg - adjust;
677 r->u.bad_conversion.from = from;
678 r->u.bad_conversion.to_type = to;
679 r->u.bad_conversion.loc = loc;
680 return r;
681}
682
683static struct rejection_reason *
684explicit_conversion_rejection (tree from, tree to)
685{
686 struct rejection_reason *r = alloc_rejection (rr_explicit_conversion);
687 r->u.conversion.n_arg = 0;
688 r->u.conversion.from = from;
689 r->u.conversion.to_type = to;
690 r->u.conversion.loc = UNKNOWN_LOCATION((location_t) 0);
691 return r;
692}
693
694static struct rejection_reason *
695template_conversion_rejection (tree from, tree to)
696{
697 struct rejection_reason *r = alloc_rejection (rr_template_conversion);
698 r->u.conversion.n_arg = 0;
699 r->u.conversion.from = from;
700 r->u.conversion.to_type = to;
701 r->u.conversion.loc = UNKNOWN_LOCATION((location_t) 0);
702 return r;
703}
704
705static struct rejection_reason *
706template_unification_rejection (tree tmpl, tree explicit_targs, tree targs,
707 const tree *args, unsigned int nargs,
708 tree return_type, unification_kind_t strict,
709 int flags)
710{
711 size_t args_n_bytes = sizeof (*args) * nargs;
712 tree *args1 = (tree *) conversion_obstack_alloc (args_n_bytes);
713 struct rejection_reason *r = alloc_rejection (rr_template_unification);
714 r->u.template_unification.tmpl = tmpl;
715 r->u.template_unification.explicit_targs = explicit_targs;
716 r->u.template_unification.num_targs = TREE_VEC_LENGTH (targs)((tree_check ((targs), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 716, __FUNCTION__, (TREE_VEC)))->base.u.length)
;
717 /* Copy args to our own storage. */
718 memcpy (args1, args, args_n_bytes);
719 r->u.template_unification.args = args1;
720 r->u.template_unification.nargs = nargs;
721 r->u.template_unification.return_type = return_type;
722 r->u.template_unification.strict = strict;
723 r->u.template_unification.flags = flags;
724 return r;
725}
726
727static struct rejection_reason *
728template_unification_error_rejection (void)
729{
730 return alloc_rejection (rr_template_unification);
731}
732
733static struct rejection_reason *
734invalid_copy_with_fn_template_rejection (void)
735{
736 struct rejection_reason *r = alloc_rejection (rr_invalid_copy);
737 return r;
738}
739
740static struct rejection_reason *
741inherited_ctor_rejection (void)
742{
743 struct rejection_reason *r = alloc_rejection (rr_inherited_ctor);
744 return r;
745}
746
747/* Build a constraint failure record. */
748
749static struct rejection_reason *
750constraint_failure (void)
751{
752 struct rejection_reason *r = alloc_rejection (rr_constraint_failure);
753 return r;
754}
755
756/* Dynamically allocate a conversion. */
757
758static conversion *
759alloc_conversion (conversion_kind kind)
760{
761 conversion *c;
762 c = (conversion *) conversion_obstack_alloc (sizeof (conversion));
763 c->kind = kind;
764 return c;
765}
766
767/* Make sure that all memory on the conversion obstack has been
768 freed. */
769
770void
771validate_conversion_obstack (void)
772{
773 if (conversion_obstack_initialized)
774 gcc_assert ((obstack_next_free (&conversion_obstack)((void)(!((((void *) (&conversion_obstack)->next_free)
== ((void *) (&conversion_obstack)->object_base))) ? fancy_abort
("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 775, __FUNCTION__), 0 : 0))
775 == obstack_base (&conversion_obstack)))((void)(!((((void *) (&conversion_obstack)->next_free)
== ((void *) (&conversion_obstack)->object_base))) ? fancy_abort
("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 775, __FUNCTION__), 0 : 0))
;
776}
777
778/* Dynamically allocate an array of N conversions. */
779
780static conversion **
781alloc_conversions (size_t n)
782{
783 return (conversion **) conversion_obstack_alloc (n * sizeof (conversion *));
784}
785
786/* True iff the active member of conversion::u for code CODE is NEXT. */
787
788static inline bool
789has_next (conversion_kind code)
790{
791 return !(code == ck_identity
792 || code == ck_ambig
793 || code == ck_list
794 || code == ck_aggr
795 || code == ck_deferred_bad);
796}
797
798static conversion *
799build_conv (conversion_kind code, tree type, conversion *from)
800{
801 conversion *t;
802 conversion_rank rank = CONVERSION_RANK (from)((from)->bad_p ? cr_bad : (from)->ellipsis_p ? cr_ellipsis
: (from)->user_conv_p ? cr_user : (from)->rank)
;
803
804 /* Only call this function for conversions that use u.next. */
805 gcc_assert (from == NULL || has_next (code))((void)(!(from == __null || has_next (code)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 805, __FUNCTION__), 0 : 0))
;
806
807 /* Note that the caller is responsible for filling in t->cand for
808 user-defined conversions. */
809 t = alloc_conversion (code);
810 t->type = type;
811 t->u.next = from;
812
813 switch (code)
814 {
815 case ck_ptr:
816 case ck_pmem:
817 case ck_base:
818 case ck_std:
819 if (rank < cr_std)
820 rank = cr_std;
821 break;
822
823 case ck_qual:
824 case ck_fnptr:
825 if (rank < cr_exact)
826 rank = cr_exact;
827 break;
828
829 default:
830 break;
831 }
832 t->rank = rank;
833 t->user_conv_p = (code == ck_user || from->user_conv_p);
834 t->bad_p = from->bad_p;
835 t->base_p = false;
836 return t;
837}
838
839/* Represent a conversion from CTOR, a braced-init-list, to TYPE, a
840 specialization of std::initializer_list<T>, if such a conversion is
841 possible. */
842
843static conversion *
844build_list_conv (tree type, tree ctor, int flags, tsubst_flags_t complain)
845{
846 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 846, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 846, __FUNCTION__))->type_non_common.lang_1))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 846, __FUNCTION__, (TEMPLATE_INFO))))->args), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 846, __FUNCTION__)))))
;
847 unsigned len = CONSTRUCTOR_NELTS (ctor)(vec_safe_length (((tree_check ((ctor), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 847, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
;
848 conversion **subconvs = alloc_conversions (len);
849 conversion *t;
850 unsigned i;
851 tree val;
852
853 /* Within a list-initialization we can have more user-defined
854 conversions. */
855 flags &= ~LOOKUP_NO_CONVERSION(1 << 4);
856 /* But no narrowing conversions. */
857 flags |= LOOKUP_NO_NARROWING((1 << 6) << 1);
858
859 /* Can't make an array of these types. */
860 if (TYPE_REF_P (elttype)(((enum tree_code) (elttype)->base.code) == REFERENCE_TYPE
)
861 || TREE_CODE (elttype)((enum tree_code) (elttype)->base.code) == FUNCTION_TYPE
862 || VOID_TYPE_P (elttype)(((enum tree_code) (elttype)->base.code) == VOID_TYPE))
863 return NULL__null;
864
865 FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (ctor), i, val)for (i = 0; (i >= vec_safe_length (((tree_check ((ctor), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 865, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))) ?
false : ((val = (*(((tree_check ((ctor), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 865, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))[
i].value), true); (i)++)
866 {
867 conversion *sub
868 = implicit_conversion (elttype, TREE_TYPE (val)((contains_struct_check ((val), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 868, __FUNCTION__))->typed.type)
, val,
869 false, flags, complain);
870 if (sub == NULL__null)
871 return NULL__null;
872
873 subconvs[i] = sub;
874 }
875
876 t = alloc_conversion (ck_list);
877 t->type = type;
878 t->u.list = subconvs;
879 t->rank = cr_exact;
880
881 for (i = 0; i < len; ++i)
882 {
883 conversion *sub = subconvs[i];
884 if (sub->rank > t->rank)
885 t->rank = sub->rank;
886 if (sub->user_conv_p)
887 t->user_conv_p = true;
888 if (sub->bad_p)
889 t->bad_p = true;
890 }
891
892 return t;
893}
894
895/* Return the next conversion of the conversion chain (if applicable),
896 or NULL otherwise. Please use this function instead of directly
897 accessing fields of struct conversion. */
898
899static conversion *
900next_conversion (conversion *conv)
901{
902 if (conv == NULL__null
903 || !has_next (conv->kind))
904 return NULL__null;
905 return conv->u.next;
906}
907
908/* Strip to the first ck_user, ck_ambig, ck_list, ck_aggr or ck_identity
909 encountered. */
910
911static conversion *
912strip_standard_conversion (conversion *conv)
913{
914 while (conv
915 && conv->kind != ck_user
916 && has_next (conv->kind))
917 conv = next_conversion (conv);
918 return conv;
919}
920
921/* Subroutine of build_aggr_conv: check whether FROM is a valid aggregate
922 initializer for array type ATYPE. */
923
924static bool
925can_convert_array (tree atype, tree from, int flags, tsubst_flags_t complain)
926{
927 tree elttype = TREE_TYPE (atype)((contains_struct_check ((atype), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 927, __FUNCTION__))->typed.type)
;
928 unsigned i;
929
930 if (TREE_CODE (from)((enum tree_code) (from)->base.code) == CONSTRUCTOR)
931 {
932 for (i = 0; i < CONSTRUCTOR_NELTS (from)(vec_safe_length (((tree_check ((from), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 932, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
; ++i)
933 {
934 tree val = CONSTRUCTOR_ELT (from, i)(&(*((tree_check ((from), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 934, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[i
])
->value;
935 bool ok;
936 if (TREE_CODE (elttype)((enum tree_code) (elttype)->base.code) == ARRAY_TYPE)
937 ok = can_convert_array (elttype, val, flags, complain);
938 else
939 ok = can_convert_arg (elttype, TREE_TYPE (val)((contains_struct_check ((val), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 939, __FUNCTION__))->typed.type)
, val, flags,
940 complain);
941 if (!ok)
942 return false;
943 }
944 return true;
945 }
946
947 if (char_type_p (TYPE_MAIN_VARIANT (elttype)((tree_class_check ((elttype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 947, __FUNCTION__))->type_common.main_variant)
)
948 && TREE_CODE (tree_strip_any_location_wrapper (from))((enum tree_code) (tree_strip_any_location_wrapper (from))->
base.code)
== STRING_CST)
949 return array_string_literal_compatible_p (atype, from);
950
951 /* No other valid way to aggregate initialize an array. */
952 return false;
953}
954
955/* Helper for build_aggr_conv. Return true if FIELD is in PSET, or if
956 FIELD has ANON_AGGR_TYPE_P and any initializable field in there recursively
957 is in PSET. */
958
959static bool
960field_in_pset (hash_set<tree, true> &pset, tree field)
961{
962 if (pset.contains (field))
963 return true;
964 if (ANON_AGGR_TYPE_P (TREE_TYPE (field))((((((enum tree_code) (((contains_struct_check ((field), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 964, __FUNCTION__))->typed.type))->base.code)) == RECORD_TYPE
|| (((enum tree_code) (((contains_struct_check ((field), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 964, __FUNCTION__))->typed.type))->base.code)) == UNION_TYPE
) && ((tree_class_check ((((contains_struct_check ((field
), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 964, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 964, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((((contains_struct_check ((field), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 964, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 964, __FUNCTION__))->type_with_lang_specific.lang_specific
))->anon_aggr)
)
965 for (field = TYPE_FIELDS (TREE_TYPE (field))((tree_check3 ((((contains_struct_check ((field), (TS_TYPED),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 965, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 965, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)
;
966 field; field = DECL_CHAIN (field)(((contains_struct_check (((contains_struct_check ((field), (
TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 966, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 966, __FUNCTION__))->common.chain))
)
967 {
968 field = next_aggregate_field (field);
969 if (field == NULL_TREE(tree) __null)
970 break;
971 if (field_in_pset (pset, field))
972 return true;
973 }
974 return false;
975}
976
977/* Represent a conversion from CTOR, a braced-init-list, to TYPE, an
978 aggregate class, if such a conversion is possible. */
979
980static conversion *
981build_aggr_conv (tree type, tree ctor, int flags, tsubst_flags_t complain)
982{
983 unsigned HOST_WIDE_INTlong i = 0;
984 conversion *c;
985 tree field = next_aggregate_field (TYPE_FIELDS (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 985, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)
);
986 tree empty_ctor = NULL_TREE(tree) __null;
987 hash_set<tree, true> pset;
988
989 /* We already called reshape_init in implicit_conversion, but it might not
990 have done anything in the case of parenthesized aggr init. */
991
992 /* The conversions within the init-list aren't affected by the enclosing
993 context; they're always simple copy-initialization. */
994 flags = LOOKUP_IMPLICIT(((1 << 0)) | (1 << 2))|LOOKUP_NO_NARROWING((1 << 6) << 1);
995
996 /* For designated initializers, verify that each initializer is convertible
997 to corresponding TREE_TYPE (ce->index) and mark those FIELD_DECLs as
998 visited. In the following loop then ignore already visited
999 FIELD_DECLs. */
1000 tree idx, val;
1001 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (ctor), i, idx, val)for (i = 0; (i >= vec_safe_length (((tree_check ((ctor), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1001, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
? false : (((void) (val = (*((tree_check ((ctor), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1001, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
i].value)), (idx = (*((tree_check ((ctor), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1001, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
i].index), true); (i)++)
1002 {
1003 if (!idx)
1004 break;
1005
1006 gcc_checking_assert (TREE_CODE (idx) == FIELD_DECL)((void)(!(((enum tree_code) (idx)->base.code) == FIELD_DECL
) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1006, __FUNCTION__), 0 : 0))
;
1007
1008 tree ftype = TREE_TYPE (idx)((contains_struct_check ((idx), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1008, __FUNCTION__))->typed.type)
;
1009 bool ok;
1010
1011 if (TREE_CODE (ftype)((enum tree_code) (ftype)->base.code) == ARRAY_TYPE)
1012 ok = can_convert_array (ftype, val, flags, complain);
1013 else
1014 ok = can_convert_arg (ftype, TREE_TYPE (val)((contains_struct_check ((val), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1014, __FUNCTION__))->typed.type)
, val, flags,
1015 complain);
1016
1017 if (!ok)
1018 return NULL__null;
1019
1020 /* For unions, there should be just one initializer. */
1021 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == UNION_TYPE)
1022 {
1023 field = NULL_TREE(tree) __null;
1024 i = 1;
1025 break;
1026 }
1027 pset.add (idx);
1028 }
1029
1030 for (; field; field = next_aggregate_field (DECL_CHAIN (field)(((contains_struct_check (((contains_struct_check ((field), (
TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1030, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1030, __FUNCTION__))->common.chain))
))
1031 {
1032 tree ftype = TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1032, __FUNCTION__))->typed.type)
;
1033 bool ok;
1034
1035 if (!pset.is_empty () && field_in_pset (pset, field))
1036 continue;
1037 if (i < CONSTRUCTOR_NELTS (ctor)(vec_safe_length (((tree_check ((ctor), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1037, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
)
1038 {
1039 constructor_elt *ce = CONSTRUCTOR_ELT (ctor, i)(&(*((tree_check ((ctor), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1039, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
i])
;
1040 gcc_checking_assert (!ce->index)((void)(!(!ce->index) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1040, __FUNCTION__), 0 : 0))
;
1041 val = ce->value;
1042 ++i;
1043 }
1044 else if (DECL_INITIAL (field)((contains_struct_check ((field), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1044, __FUNCTION__))->decl_common.initial)
)
1045 val = get_nsdmi (field, /*ctor*/false, complain);
1046 else if (TYPE_REF_P (ftype)(((enum tree_code) (ftype)->base.code) == REFERENCE_TYPE))
1047 /* Value-initialization of reference is ill-formed. */
1048 return NULL__null;
1049 else
1050 {
1051 if (empty_ctor == NULL_TREE(tree) __null)
1052 empty_ctor = build_constructor (init_list_type_nodecp_global_trees[CPTI_INIT_LIST_TYPE], NULL__null);
1053 val = empty_ctor;
1054 }
1055
1056 if (TREE_CODE (ftype)((enum tree_code) (ftype)->base.code) == ARRAY_TYPE)
1057 ok = can_convert_array (ftype, val, flags, complain);
1058 else
1059 ok = can_convert_arg (ftype, TREE_TYPE (val)((contains_struct_check ((val), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1059, __FUNCTION__))->typed.type)
, val, flags,
1060 complain);
1061
1062 if (!ok)
1063 return NULL__null;
1064
1065 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == UNION_TYPE)
1066 break;
1067 }
1068
1069 if (i < CONSTRUCTOR_NELTS (ctor)(vec_safe_length (((tree_check ((ctor), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1069, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
)
1070 return NULL__null;
1071
1072 c = alloc_conversion (ck_aggr);
1073 c->type = type;
1074 c->rank = cr_exact;
1075 c->user_conv_p = true;
1076 c->check_narrowing = true;
1077 c->u.expr = ctor;
1078 return c;
1079}
1080
1081/* Represent a conversion from CTOR, a braced-init-list, to TYPE, an
1082 array type, if such a conversion is possible. */
1083
1084static conversion *
1085build_array_conv (tree type, tree ctor, int flags, tsubst_flags_t complain)
1086{
1087 conversion *c;
1088 unsigned HOST_WIDE_INTlong len = CONSTRUCTOR_NELTS (ctor)(vec_safe_length (((tree_check ((ctor), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1088, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
;
1089 tree elttype = TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1089, __FUNCTION__))->typed.type)
;
1090 bool bad = false;
1091 bool user = false;
1092 enum conversion_rank rank = cr_exact;
1093
1094 /* We might need to propagate the size from the element to the array. */
1095 complete_type (type);
1096
1097 if (TYPE_DOMAIN (type)((tree_check ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1097, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)
1098 && !variably_modified_type_p (TYPE_DOMAIN (type)((tree_check ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1098, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)
, NULL_TREE(tree) __null))
1099 {
1100 unsigned HOST_WIDE_INTlong alen = tree_to_uhwi (array_type_nelts_top (type));
1101 if (alen < len)
1102 return NULL__null;
1103 }
1104
1105 flags = LOOKUP_IMPLICIT(((1 << 0)) | (1 << 2))|LOOKUP_NO_NARROWING((1 << 6) << 1);
1106
1107 for (auto &e: CONSTRUCTOR_ELTS (ctor)((tree_check ((ctor), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1107, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
)
1108 {
1109 conversion *sub
1110 = implicit_conversion (elttype, TREE_TYPE (e.value)((contains_struct_check ((e.value), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1110, __FUNCTION__))->typed.type)
, e.value,
1111 false, flags, complain);
1112 if (sub == NULL__null)
1113 return NULL__null;
1114
1115 if (sub->rank > rank)
1116 rank = sub->rank;
1117 if (sub->user_conv_p)
1118 user = true;
1119 if (sub->bad_p)
1120 bad = true;
1121 }
1122
1123 c = alloc_conversion (ck_aggr);
1124 c->type = type;
1125 c->rank = rank;
1126 c->user_conv_p = user;
1127 c->bad_p = bad;
1128 c->u.expr = ctor;
1129 return c;
1130}
1131
1132/* Represent a conversion from CTOR, a braced-init-list, to TYPE, a
1133 complex type, if such a conversion is possible. */
1134
1135static conversion *
1136build_complex_conv (tree type, tree ctor, int flags,
1137 tsubst_flags_t complain)
1138{
1139 conversion *c;
1140 unsigned HOST_WIDE_INTlong len = CONSTRUCTOR_NELTS (ctor)(vec_safe_length (((tree_check ((ctor), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1140, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
;
1141 tree elttype = TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1141, __FUNCTION__))->typed.type)
;
1142 bool bad = false;
1143 bool user = false;
1144 enum conversion_rank rank = cr_exact;
1145
1146 if (len != 2)
1147 return NULL__null;
1148
1149 flags = LOOKUP_IMPLICIT(((1 << 0)) | (1 << 2))|LOOKUP_NO_NARROWING((1 << 6) << 1);
1150
1151 for (auto &e: CONSTRUCTOR_ELTS (ctor)((tree_check ((ctor), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1151, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
)
1152 {
1153 conversion *sub
1154 = implicit_conversion (elttype, TREE_TYPE (e.value)((contains_struct_check ((e.value), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1154, __FUNCTION__))->typed.type)
, e.value,
1155 false, flags, complain);
1156 if (sub == NULL__null)
1157 return NULL__null;
1158
1159 if (sub->rank > rank)
1160 rank = sub->rank;
1161 if (sub->user_conv_p)
1162 user = true;
1163 if (sub->bad_p)
1164 bad = true;
1165 }
1166
1167 c = alloc_conversion (ck_aggr);
1168 c->type = type;
1169 c->rank = rank;
1170 c->user_conv_p = user;
1171 c->bad_p = bad;
1172 c->u.expr = ctor;
1173 return c;
1174}
1175
1176/* Build a representation of the identity conversion from EXPR to
1177 itself. The TYPE should match the type of EXPR, if EXPR is non-NULL. */
1178
1179static conversion *
1180build_identity_conv (tree type, tree expr)
1181{
1182 conversion *c;
1183
1184 c = alloc_conversion (ck_identity);
1185 c->type = type;
1186 c->u.expr = expr;
1187
1188 return c;
1189}
1190
1191/* Converting from EXPR to TYPE was ambiguous in the sense that there
1192 were multiple user-defined conversions to accomplish the job.
1193 Build a conversion that indicates that ambiguity. */
1194
1195static conversion *
1196build_ambiguous_conv (tree type, tree expr)
1197{
1198 conversion *c;
1199
1200 c = alloc_conversion (ck_ambig);
1201 c->type = type;
1202 c->u.expr = expr;
1203
1204 return c;
1205}
1206
1207tree
1208strip_top_quals (tree t)
1209{
1210 if (TREE_CODE (t)((enum tree_code) (t)->base.code) == ARRAY_TYPE)
1211 return t;
1212 return cp_build_qualified_type (t, 0);
1213}
1214
1215/* Returns the standard conversion path (see [conv]) from type FROM to type
1216 TO, if any. For proper handling of null pointer constants, you must
1217 also pass the expression EXPR to convert from. If C_CAST_P is true,
1218 this conversion is coming from a C-style cast. */
1219
1220static conversion *
1221standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
1222 int flags, tsubst_flags_t complain)
1223{
1224 enum tree_code fcode, tcode;
1225 conversion *conv;
1226 bool fromref = false;
1227 tree qualified_to;
1228
1229 to = non_reference (to);
1230 if (TYPE_REF_P (from)(((enum tree_code) (from)->base.code) == REFERENCE_TYPE))
1231 {
1232 fromref = true;
1233 from = TREE_TYPE (from)((contains_struct_check ((from), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1233, __FUNCTION__))->typed.type)
;
1234 }
1235 qualified_to = to;
1236 to = strip_top_quals (to);
1237 from = strip_top_quals (from);
1238
1239 if (expr && type_unknown_p (expr))
1240 {
1241 if (TYPE_PTRFN_P (to)((((enum tree_code) (to)->base.code) == POINTER_TYPE) &&
((enum tree_code) (((contains_struct_check ((to), (TS_TYPED)
, "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1241, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1241, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1241, __FUNCTION__))->type_common.lang_flag_2)))
)
1242 {
1243 tsubst_flags_t tflags = tf_conv;
1244 expr = instantiate_type (to, expr, tflags);
1245 if (expr == error_mark_nodeglobal_trees[TI_ERROR_MARK])
1246 return NULL__null;
1247 from = TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1247, __FUNCTION__))->typed.type)
;
1248 }
1249 else if (TREE_CODE (to)((enum tree_code) (to)->base.code) == BOOLEAN_TYPE)
1250 {
1251 /* Necessary for eg, TEMPLATE_ID_EXPRs (c++/50961). */
1252 expr = resolve_nondeduced_context (expr, complain);
1253 from = TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1253, __FUNCTION__))->typed.type)
;
1254 }
1255 }
1256
1257 fcode = TREE_CODE (from)((enum tree_code) (from)->base.code);
1258 tcode = TREE_CODE (to)((enum tree_code) (to)->base.code);
1259
1260 conv = build_identity_conv (from, expr);
1261 if (fcode == FUNCTION_TYPE || fcode == ARRAY_TYPE)
1262 {
1263 from = type_decays_to (from);
1264 fcode = TREE_CODE (from)((enum tree_code) (from)->base.code);
1265 /* Tell convert_like that we're using the address. */
1266 conv->rvaluedness_matches_p = true;
1267 conv = build_conv (ck_lvalue, from, conv);
1268 }
1269 /* Wrapping a ck_rvalue around a class prvalue (as a result of using
1270 obvalue_p) seems odd, since it's already a prvalue, but that's how we
1271 express the copy constructor call required by copy-initialization. */
1272 else if (fromref || (expr && obvalue_p (expr)))
1273 {
1274 if (expr)
1275 {
1276 tree bitfield_type;
1277 bitfield_type = is_bitfield_expr_with_lowered_type (expr);
1278 if (bitfield_type)
1279 {
1280 from = strip_top_quals (bitfield_type);
1281 fcode = TREE_CODE (from)((enum tree_code) (from)->base.code);
1282 }
1283 }
1284 conv = build_conv (ck_rvalue, from, conv);
1285 /* If we're performing copy-initialization, remember to skip
1286 explicit constructors. */
1287 if (flags & LOOKUP_ONLYCONVERTING(1 << 2))
1288 conv->copy_init_p = true;
1289 }
1290
1291 /* Allow conversion between `__complex__' data types. */
1292 if (tcode == COMPLEX_TYPE && fcode == COMPLEX_TYPE)
1293 {
1294 /* The standard conversion sequence to convert FROM to TO is
1295 the standard conversion sequence to perform componentwise
1296 conversion. */
1297 conversion *part_conv = standard_conversion
1298 (TREE_TYPE (to)((contains_struct_check ((to), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1298, __FUNCTION__))->typed.type)
, TREE_TYPE (from)((contains_struct_check ((from), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1298, __FUNCTION__))->typed.type)
, NULL_TREE(tree) __null, c_cast_p, flags,
1299 complain);
1300
1301 if (!part_conv)
1302 conv = NULL__null;
1303 else if (part_conv->kind == ck_identity)
1304 /* Leave conv alone. */;
1305 else
1306 {
1307 conv = build_conv (part_conv->kind, to, conv);
1308 conv->rank = part_conv->rank;
1309 }
1310
1311 return conv;
1312 }
1313
1314 if (same_type_p (from, to)comptypes ((from), (to), 0))
1315 {
1316 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1316, __FUNCTION__))->type_common.lang_flag_5))
&& conv->kind == ck_rvalue)
1317 conv->type = qualified_to;
1318 return conv;
1319 }
1320
1321 /* [conv.ptr]
1322 A null pointer constant can be converted to a pointer type; ... A
1323 null pointer constant of integral type can be converted to an
1324 rvalue of type std::nullptr_t. */
1325 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1325, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1325, __FUNCTION__))->type_common.lang_flag_2))))
1326 || NULLPTR_TYPE_P (to)(((enum tree_code) (to)->base.code) == NULLPTR_TYPE))
1327 && ((expr && null_ptr_cst_p (expr))
1328 || NULLPTR_TYPE_P (from)(((enum tree_code) (from)->base.code) == NULLPTR_TYPE)))
1329 conv = build_conv (ck_std, to, conv);
1330 else if ((tcode == INTEGER_TYPE && fcode == POINTER_TYPE)
1331 || (tcode == POINTER_TYPE && fcode == INTEGER_TYPE))
1332 {
1333 /* For backwards brain damage compatibility, allow interconversion of
1334 pointers and integers with a pedwarn. */
1335 conv = build_conv (ck_std, to, conv);
1336 conv->bad_p = true;
1337 }
1338 else if (UNSCOPED_ENUM_P (to)(((enum tree_code) (to)->base.code) == ENUMERAL_TYPE &&
!((tree_check ((to), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1338, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
)
&& fcode == INTEGER_TYPE)
1339 {
1340 /* For backwards brain damage compatibility, allow interconversion of
1341 enums and integers with a pedwarn. */
1342 conv = build_conv (ck_std, to, conv);
1343 conv->bad_p = true;
1344 }
1345 else if ((tcode == POINTER_TYPE && fcode == POINTER_TYPE)
1346 || (TYPE_PTRDATAMEM_P (to)(((enum tree_code) (to)->base.code) == OFFSET_TYPE) && TYPE_PTRDATAMEM_P (from)(((enum tree_code) (from)->base.code) == OFFSET_TYPE)))
1347 {
1348 tree to_pointee;
1349 tree from_pointee;
1350
1351 if (tcode == POINTER_TYPE)
1352 {
1353 to_pointee = TREE_TYPE (to)((contains_struct_check ((to), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1353, __FUNCTION__))->typed.type)
;
1354 from_pointee = TREE_TYPE (from)((contains_struct_check ((from), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1354, __FUNCTION__))->typed.type)
;
1355
1356 /* Since this is the target of a pointer, it can't have function
1357 qualifiers, so any TYPE_QUALS must be for attributes const or
1358 noreturn. Strip them. */
1359 if (TREE_CODE (to_pointee)((enum tree_code) (to_pointee)->base.code) == FUNCTION_TYPE
1360 && TYPE_QUALS (to_pointee)((int) ((((tree_class_check ((to_pointee), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1360, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST
) | (((tree_class_check ((to_pointee), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1360, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE
) | (((tree_class_check ((to_pointee), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1360, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC
) | (((tree_class_check ((to_pointee), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1360, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT
) | (((((tree_class_check ((to_pointee), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1360, __FUNCTION__))->base.u.bits.address_space) & 0xFF
) << 8))))
)
1361 to_pointee = build_qualified_type (to_pointee, TYPE_UNQUALIFIED);
1362 if (TREE_CODE (from_pointee)((enum tree_code) (from_pointee)->base.code) == FUNCTION_TYPE
1363 && TYPE_QUALS (from_pointee)((int) ((((tree_class_check ((from_pointee), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1363, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST
) | (((tree_class_check ((from_pointee), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1363, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE
) | (((tree_class_check ((from_pointee), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1363, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC
) | (((tree_class_check ((from_pointee), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1363, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT
) | (((((tree_class_check ((from_pointee), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1363, __FUNCTION__))->base.u.bits.address_space) & 0xFF
) << 8))))
)
1364 from_pointee = build_qualified_type (from_pointee, TYPE_UNQUALIFIED);
1365 }
1366 else
1367 {
1368 to_pointee = TYPE_PTRMEM_POINTED_TO_TYPE (to)((((enum tree_code) (to)->base.code) == OFFSET_TYPE) ? ((contains_struct_check
((to), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1368, __FUNCTION__))->typed.type) : ((contains_struct_check
(((cp_build_qualified_type (((contains_struct_check ((((tree_check3
((to), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1368, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1368, __FUNCTION__))->typed.type), cp_type_quals (to))))
, (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1368, __FUNCTION__))->typed.type))
;
1369 from_pointee = TYPE_PTRMEM_POINTED_TO_TYPE (from)((((enum tree_code) (from)->base.code) == OFFSET_TYPE) ? (
(contains_struct_check ((from), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1369, __FUNCTION__))->typed.type) : ((contains_struct_check
(((cp_build_qualified_type (((contains_struct_check ((((tree_check3
((from), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1369, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1369, __FUNCTION__))->typed.type), cp_type_quals (from))
)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1369, __FUNCTION__))->typed.type))
;
1370 }
1371
1372 if (tcode == POINTER_TYPE
1373 && same_type_ignoring_top_level_qualifiers_p (from_pointee,
1374 to_pointee))
1375 ;
1376 else if (VOID_TYPE_P (to_pointee)(((enum tree_code) (to_pointee)->base.code) == VOID_TYPE)
1377 && !TYPE_PTRDATAMEM_P (from)(((enum tree_code) (from)->base.code) == OFFSET_TYPE)
1378 && TREE_CODE (from_pointee)((enum tree_code) (from_pointee)->base.code) != FUNCTION_TYPE)
1379 {
1380 tree nfrom = TREE_TYPE (from)((contains_struct_check ((from), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1380, __FUNCTION__))->typed.type)
;
1381 /* Don't try to apply restrict to void. */
1382 int quals = cp_type_quals (nfrom) & ~TYPE_QUAL_RESTRICT;
1383 from_pointee = cp_build_qualified_type (void_type_nodeglobal_trees[TI_VOID_TYPE], quals);
1384 from = build_pointer_type (from_pointee);
1385 conv = build_conv (ck_ptr, from, conv);
1386 }
1387 else if (TYPE_PTRDATAMEM_P (from)(((enum tree_code) (from)->base.code) == OFFSET_TYPE))
1388 {
1389 tree fbase = TYPE_PTRMEM_CLASS_TYPE (from)((((enum tree_code) (from)->base.code) == OFFSET_TYPE) ? (
(tree_check ((from), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1389, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval
) : ((tree_check2 ((((contains_struct_check (((cp_build_qualified_type
(((contains_struct_check ((((tree_check3 ((from), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1389, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1389, __FUNCTION__))->typed.type), cp_type_quals (from))
)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1389, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1389, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.maxval))
;
1390 tree tbase = TYPE_PTRMEM_CLASS_TYPE (to)((((enum tree_code) (to)->base.code) == OFFSET_TYPE) ? ((tree_check
((to), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1390, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval
) : ((tree_check2 ((((contains_struct_check (((cp_build_qualified_type
(((contains_struct_check ((((tree_check3 ((to), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1390, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1390, __FUNCTION__))->typed.type), cp_type_quals (to))))
, (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1390, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1390, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.maxval))
;
1391
1392 if (same_type_p (fbase, tbase)comptypes ((fbase), (tbase), 0))
1393 /* No base conversion needed. */;
1394 else if (DERIVED_FROM_P (fbase, tbase)(lookup_base ((tbase), (fbase), ba_any, __null, tf_none) != (
tree) __null)
1395 && (same_type_ignoring_top_level_qualifiers_p
1396 (from_pointee, to_pointee)))
1397 {
1398 from = build_ptrmem_type (tbase, from_pointee);
1399 conv = build_conv (ck_pmem, from, conv);
1400 }
1401 else
1402 return NULL__null;
1403 }
1404 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1404, __FUNCTION__))->type_common.lang_flag_5))
1405 && 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1405, __FUNCTION__))->type_common.lang_flag_5))
1406 /* [conv.ptr]
1407
1408 An rvalue of type "pointer to cv D," where D is a
1409 class type, can be converted to an rvalue of type
1410 "pointer to cv B," where B is a base class (clause
1411 _class.derived_) of D. If B is an inaccessible
1412 (clause _class.access_) or ambiguous
1413 (_class.member.lookup_) base class of D, a program
1414 that necessitates this conversion is ill-formed.
1415 Therefore, we use DERIVED_FROM_P, and do not check
1416 access or uniqueness. */
1417 && DERIVED_FROM_P (to_pointee, from_pointee)(lookup_base ((from_pointee), (to_pointee), ba_any, __null, tf_none
) != (tree) __null)
)
1418 {
1419 from_pointee
1420 = cp_build_qualified_type (to_pointee,
1421 cp_type_quals (from_pointee));
1422 from = build_pointer_type (from_pointee);
1423 conv = build_conv (ck_ptr, from, conv);
1424 conv->base_p = true;
1425 }
1426
1427 if (same_type_p (from, to)comptypes ((from), (to), 0))
1428 /* OK */;
1429 else if (c_cast_p && comp_ptr_ttypes_const (to, from, bounds_either))
1430 /* In a C-style cast, we ignore CV-qualification because we
1431 are allowed to perform a static_cast followed by a
1432 const_cast. */
1433 conv = build_conv (ck_qual, to, conv);
1434 else if (!c_cast_p && comp_ptr_ttypes (to_pointee, from_pointee))
1435 conv = build_conv (ck_qual, to, conv);
1436 else if (expr && string_conv_p (to, expr, 0))
1437 /* converting from string constant to char *. */
1438 conv = build_conv (ck_qual, to, conv);
1439 else if (fnptr_conv_p (to, from))
1440 conv = build_conv (ck_fnptr, to, conv);
1441 /* Allow conversions among compatible ObjC pointer types (base
1442 conversions have been already handled above). */
1443 else if (c_dialect_objc ()((c_language & clk_objc) != 0)
1444 && objc_compare_types (to, from, -4, NULL_TREE(tree) __null))
1445 conv = build_conv (ck_ptr, to, conv);
1446 else if (ptr_reasonably_similar (to_pointee, from_pointee))
1447 {
1448 conv = build_conv (ck_ptr, to, conv);
1449 conv->bad_p = true;
1450 }
1451 else
1452 return NULL__null;
1453
1454 from = to;
1455 }
1456 else if (TYPE_PTRMEMFUNC_P (to)(((enum tree_code) (to)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((to), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1456, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1456, __FUNCTION__))->type_common.lang_flag_2)))
&& TYPE_PTRMEMFUNC_P (from)(((enum tree_code) (from)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((from), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1456, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1456, __FUNCTION__))->type_common.lang_flag_2)))
)
1457 {
1458 tree fromfn = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (from))((contains_struct_check (((cp_build_qualified_type (((contains_struct_check
((((tree_check3 ((from), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1458, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1458, __FUNCTION__))->typed.type), cp_type_quals (from))
)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1458, __FUNCTION__))->typed.type)
;
1459 tree tofn = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (to))((contains_struct_check (((cp_build_qualified_type (((contains_struct_check
((((tree_check3 ((to), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1459, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1459, __FUNCTION__))->typed.type), cp_type_quals (to))))
, (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1459, __FUNCTION__))->typed.type)
;
1460 tree fbase = class_of_this_parm (fromfn);
1461 tree tbase = class_of_this_parm (tofn);
1462
1463 /* If FBASE and TBASE are equivalent but incomplete, DERIVED_FROM_P
1464 yields false. But a pointer to member of incomplete class is OK. */
1465 if (!same_type_p (fbase, tbase)comptypes ((fbase), (tbase), 0) && !DERIVED_FROM_P (fbase, tbase)(lookup_base ((tbase), (fbase), ba_any, __null, tf_none) != (
tree) __null)
)
1466 return NULL__null;
1467
1468 tree fstat = static_fn_type (fromfn);
1469 tree tstat = static_fn_type (tofn);
1470 if (same_type_p (tstat, fstat)comptypes ((tstat), (fstat), 0)
1471 || fnptr_conv_p (tstat, fstat))
1472 /* OK */;
1473 else
1474 return NULL__null;
1475
1476 if (!same_type_p (fbase, tbase)comptypes ((fbase), (tbase), 0))
1477 {
1478 from = build_memfn_type (fstat,
1479 tbase,
1480 cp_type_quals (tbase),
1481 type_memfn_rqual (tofn));
1482 from = build_ptrmemfunc_type (build_pointer_type (from));
1483 conv = build_conv (ck_pmem, from, conv);
1484 conv->base_p = true;
1485 }
1486 if (fnptr_conv_p (tstat, fstat))
1487 conv = build_conv (ck_fnptr, to, conv);
1488 }
1489 else if (tcode == BOOLEAN_TYPE)
1490 {
1491 /* [conv.bool]
1492
1493 A prvalue of arithmetic, unscoped enumeration, pointer, or pointer
1494 to member type can be converted to a prvalue of type bool. ...
1495 For direct-initialization (8.5 [dcl.init]), a prvalue of type
1496 std::nullptr_t can be converted to a prvalue of type bool; */
1497 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)
1498 || UNSCOPED_ENUM_P (from)(((enum tree_code) (from)->base.code) == ENUMERAL_TYPE &&
!((tree_check ((from), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1498, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
)
1499 || fcode == POINTER_TYPE
1500 || 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1500, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1500, __FUNCTION__))->type_common.lang_flag_2))))
1501 || NULLPTR_TYPE_P (from)(((enum tree_code) (from)->base.code) == NULLPTR_TYPE))
1502 {
1503 conv = build_conv (ck_std, to, conv);
1504 if (fcode == POINTER_TYPE
1505 || TYPE_PTRDATAMEM_P (from)(((enum tree_code) (from)->base.code) == OFFSET_TYPE)
1506 || (TYPE_PTRMEMFUNC_P (from)(((enum tree_code) (from)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((from), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1506, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1506, __FUNCTION__))->type_common.lang_flag_2)))
1507 && conv->rank < cr_pbool)
1508 || NULLPTR_TYPE_P (from)(((enum tree_code) (from)->base.code) == NULLPTR_TYPE))
1509 conv->rank = cr_pbool;
1510 if (NULLPTR_TYPE_P (from)(((enum tree_code) (from)->base.code) == NULLPTR_TYPE) && (flags & LOOKUP_ONLYCONVERTING(1 << 2)))
1511 conv->bad_p = true;
1512 if (flags & LOOKUP_NO_NARROWING((1 << 6) << 1))
1513 conv->check_narrowing = true;
1514 return conv;
1515 }
1516
1517 return NULL__null;
1518 }
1519 /* We don't check for ENUMERAL_TYPE here because there are no standard
1520 conversions to enum type. */
1521 /* As an extension, allow conversion to complex type. */
1522 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)
)
1523 {
1524 if (! (INTEGRAL_CODE_P (fcode)((fcode) == ENUMERAL_TYPE || (fcode) == BOOLEAN_TYPE || (fcode
) == INTEGER_TYPE)
1525 || (fcode == REAL_TYPE && !(flags & LOOKUP_NO_NON_INTEGRAL((((((((((1 << 6) << 1) << 1) << 1) <<
1) << 1) << 1) << 1) << 1) << 1
)
)))
1526 || SCOPED_ENUM_P (from)(((enum tree_code) (from)->base.code) == ENUMERAL_TYPE &&
((tree_check ((from), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1526, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
)
)
1527 return NULL__null;
1528
1529 /* If we're parsing an enum with no fixed underlying type, we're
1530 dealing with an incomplete type, which renders the conversion
1531 ill-formed. */
1532 if (!COMPLETE_TYPE_P (from)(((tree_class_check ((from), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1532, __FUNCTION__))->type_common.size) != (tree) __null
)
)
1533 return NULL__null;
1534
1535 conv = build_conv (ck_std, to, conv);
1536
1537 tree underlying_type = NULL_TREE(tree) __null;
1538 if (TREE_CODE (from)((enum tree_code) (from)->base.code) == ENUMERAL_TYPE
1539 && ENUM_FIXED_UNDERLYING_TYPE_P (from)(((tree_class_check ((from), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1539, __FUNCTION__))->type_common.lang_flag_5))
)
1540 underlying_type = ENUM_UNDERLYING_TYPE (from)((contains_struct_check (((tree_check ((from), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1540, __FUNCTION__, (ENUMERAL_TYPE)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1540, __FUNCTION__))->typed.type)
;
1541
1542 /* Give this a better rank if it's a promotion.
1543
1544 To handle CWG 1601, also bump the rank if we are converting
1545 an enumeration with a fixed underlying type to the underlying
1546 type. */
1547 if ((same_type_p (to, type_promotes_to (from))comptypes ((to), (type_promotes_to (from)), 0)
1548 || (underlying_type && same_type_p (to, underlying_type)comptypes ((to), (underlying_type), 0)))
1549 && next_conversion (conv)->rank <= cr_promotion)
1550 conv->rank = cr_promotion;
1551
1552 /* A prvalue of floating-point type can be converted to a prvalue of
1553 another floating-point type with a greater or equal conversion
1554 rank ([conv.rank]). A prvalue of standard floating-point type can
1555 be converted to a prvalue of another standard floating-point type.
1556 For backwards compatibility with handling __float128 and other
1557 non-standard floating point types, allow all implicit floating
1558 point conversions if neither type is extended floating-point
1559 type and if at least one of them is, fail if they have unordered
1560 conversion rank or from has higher conversion rank. */
1561 if (fcode == REAL_TYPE
1562 && tcode == REAL_TYPE
1563 && (extended_float_type_p (from)
1564 || extended_float_type_p (to))
1565 && cp_compare_floating_point_conversion_ranks (from, to) >= 2)
1566 conv->bad_p = true;
1567 }
1568 else if (fcode == VECTOR_TYPE && tcode == VECTOR_TYPE
1569 && vector_types_convertible_p (from, to, false))
1570 return build_conv (ck_std, to, conv);
1571 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) == TRAIT_TYPE || ((enum
tree_code) (to)->base.code) == DEPENDENT_OPERATOR_TYPE) ||
(((((enum tree_code) (to)->base.code)) == RECORD_TYPE || (
((enum tree_code) (to)->base.code)) == UNION_TYPE) &&
((tree_class_check ((to), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1571, __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) == TRAIT_TYPE || ((enum
tree_code) (from)->base.code) == DEPENDENT_OPERATOR_TYPE)
|| (((((enum tree_code) (from)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (from)->base.code)) == UNION_TYPE) &&
((tree_class_check ((from), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1571, __FUNCTION__))->type_common.lang_flag_5)))
1572 && is_properly_derived_from (from, to))
1573 {
1574 if (conv->kind == ck_rvalue)
1575 conv = next_conversion (conv);
1576 conv = build_conv (ck_base, to, conv);
1577 /* The derived-to-base conversion indicates the initialization
1578 of a parameter with base type from an object of a derived
1579 type. A temporary object is created to hold the result of
1580 the conversion unless we're binding directly to a reference. */
1581 conv->need_temporary_p = !(flags & LOOKUP_NO_TEMP_BIND(1 << 6));
1582 /* If we're performing copy-initialization, remember to skip
1583 explicit constructors. */
1584 if (flags & LOOKUP_ONLYCONVERTING(1 << 2))
1585 conv->copy_init_p = true;
1586 }
1587 else
1588 return NULL__null;
1589
1590 if (flags & LOOKUP_NO_NARROWING((1 << 6) << 1))
1591 conv->check_narrowing = true;
1592
1593 return conv;
1594}
1595
1596/* Returns nonzero if T1 is reference-related to T2. */
1597
1598bool
1599reference_related_p (tree t1, tree t2)
1600{
1601 if (t1 == error_mark_nodeglobal_trees[TI_ERROR_MARK] || t2 == error_mark_nodeglobal_trees[TI_ERROR_MARK])
1602 return false;
1603
1604 t1 = TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1604, __FUNCTION__))->type_common.main_variant)
;
1605 t2 = TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1605, __FUNCTION__))->type_common.main_variant)
;
1606
1607 /* [dcl.init.ref]
1608
1609 Given types "cv1 T1" and "cv2 T2," "cv1 T1" is reference-related
1610 to "cv2 T2" if T1 is similar to T2, or T1 is a base class of T2. */
1611 return (similar_type_p (t1, t2)
1612 || (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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1612, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1612, __FUNCTION__))->type_common.lang_flag_5))
1613 && DERIVED_FROM_P (t1, t2)(lookup_base ((t2), (t1), ba_any, __null, tf_none) != (tree) __null
)
));
1614}
1615
1616/* Returns nonzero if T1 is reference-compatible with T2. */
1617
1618bool
1619reference_compatible_p (tree t1, tree t2)
1620{
1621 /* [dcl.init.ref]
1622
1623 "cv1 T1" is reference compatible with "cv2 T2" if
1624 a prvalue of type "pointer to cv2 T2" can be converted to the type
1625 "pointer to cv1 T1" via a standard conversion sequence. */
1626 tree ptype1 = build_pointer_type (t1);
1627 tree ptype2 = build_pointer_type (t2);
1628 conversion *conv = standard_conversion (ptype1, ptype2, NULL_TREE(tree) __null,
1629 /*c_cast_p=*/false, 0, tf_none);
1630 if (!conv || conv->bad_p)
1631 return false;
1632 return true;
1633}
1634
1635/* Return true if converting FROM to TO would involve a qualification
1636 conversion. */
1637
1638static bool
1639involves_qualification_conversion_p (tree to, tree from)
1640{
1641 /* If we're not convering a pointer to another one, we won't get
1642 a qualification conversion. */
1643 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))
1644 || (TYPE_PTRDATAMEM_P (to)(((enum tree_code) (to)->base.code) == OFFSET_TYPE) && TYPE_PTRDATAMEM_P (from)(((enum tree_code) (from)->base.code) == OFFSET_TYPE))))
1645 return false;
1646
1647 conversion *conv = standard_conversion (to, from, NULL_TREE(tree) __null,
1648 /*c_cast_p=*/false, 0, tf_none);
1649 for (conversion *t = conv; t; t = next_conversion (t))
1650 if (t->kind == ck_qual)
1651 return true;
1652
1653 return false;
1654}
1655
1656/* A reference of the indicated TYPE is being bound directly to the
1657 expression represented by the implicit conversion sequence CONV.
1658 Return a conversion sequence for this binding. */
1659
1660static conversion *
1661direct_reference_binding (tree type, conversion *conv)
1662{
1663 tree t;
1664
1665 gcc_assert (TYPE_REF_P (type))((void)(!((((enum tree_code) (type)->base.code) == REFERENCE_TYPE
)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1665, __FUNCTION__), 0 : 0))
;
1666 gcc_assert (!TYPE_REF_P (conv->type))((void)(!(!(((enum tree_code) (conv->type)->base.code) ==
REFERENCE_TYPE)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1666, __FUNCTION__), 0 : 0))
;
1667
1668 t = TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1668, __FUNCTION__))->typed.type)
;
1669
1670 if (conv->kind == ck_identity)
1671 /* Mark the identity conv as to not decay to rvalue. */
1672 conv->rvaluedness_matches_p = true;
1673
1674 /* [over.ics.rank]
1675
1676 When a parameter of reference type binds directly
1677 (_dcl.init.ref_) to an argument expression, the implicit
1678 conversion sequence is the identity conversion, unless the
1679 argument expression has a type that is a derived class of the
1680 parameter type, in which case the implicit conversion sequence is
1681 a derived-to-base Conversion.
1682
1683 If the parameter binds directly to the result of applying a
1684 conversion function to the argument expression, the implicit
1685 conversion sequence is a user-defined conversion sequence
1686 (_over.ics.user_), with the second standard conversion sequence
1687 either an identity conversion or, if the conversion function
1688 returns an entity of a type that is a derived class of the
1689 parameter type, a derived-to-base conversion. */
1690 if (is_properly_derived_from (conv->type, t))
1691 {
1692 /* Represent the derived-to-base conversion. */
1693 conv = build_conv (ck_base, t, conv);
1694 /* We will actually be binding to the base-class subobject in
1695 the derived class, so we mark this conversion appropriately.
1696 That way, convert_like knows not to generate a temporary. */
1697 conv->need_temporary_p = false;
1698 }
1699 else if (involves_qualification_conversion_p (t, conv->type))
1700 /* Represent the qualification conversion. After DR 2352
1701 #1 and #2 were indistinguishable conversion sequences:
1702
1703 void f(int*); // #1
1704 void f(const int* const &); // #2
1705 void g(int* p) { f(p); }
1706
1707 because the types "int *" and "const int *const" are
1708 reference-related and we were binding both directly and they
1709 had the same rank. To break it up, we add a ck_qual under the
1710 ck_ref_bind so that conversion sequence ranking chooses #1.
1711
1712 We strip_top_quals here which is also what standard_conversion
1713 does. Failure to do so would confuse comp_cv_qual_signature
1714 into thinking that in
1715
1716 void f(const int * const &); // #1
1717 void f(const int *); // #2
1718 int *x;
1719 f(x);
1720
1721 #2 is a better match than #1 even though they're ambiguous (97296). */
1722 conv = build_conv (ck_qual, strip_top_quals (t), conv);
1723
1724 return build_conv (ck_ref_bind, type, conv);
1725}
1726
1727/* Returns the conversion path from type FROM to reference type TO for
1728 purposes of reference binding. For lvalue binding, either pass a
1729 reference type to FROM or an lvalue expression to EXPR. If the
1730 reference will be bound to a temporary, NEED_TEMPORARY_P is set for
1731 the conversion returned. If C_CAST_P is true, this
1732 conversion is coming from a C-style cast. */
1733
1734static conversion *
1735reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags,
1736 tsubst_flags_t complain)
1737{
1738 conversion *conv = NULL__null;
1739 tree to = TREE_TYPE (rto)((contains_struct_check ((rto), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1739, __FUNCTION__))->typed.type)
;
1740 tree from = rfrom;
1741 tree tfrom;
1742 bool related_p;
1743 bool compatible_p;
1744 cp_lvalue_kind gl_kind;
1745 bool is_lvalue;
1746
1747 if (TREE_CODE (to)((enum tree_code) (to)->base.code) == FUNCTION_TYPE && expr && type_unknown_p (expr))
1748 {
1749 expr = instantiate_type (to, expr, tf_none);
1750 if (expr == error_mark_nodeglobal_trees[TI_ERROR_MARK])
1751 return NULL__null;
1752 from = TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1752, __FUNCTION__))->typed.type)
;
1753 }
1754
1755 bool copy_list_init = false;
1756 if (expr && BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1756, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
)
1757 {
1758 maybe_warn_cpp0x (CPP0X_INITIALIZER_LISTS);
1759 /* DR 1288: Otherwise, if the initializer list has a single element
1760 of type E and ... [T's] referenced type is reference-related to E,
1761 the object or reference is initialized from that element...
1762
1763 ??? With P0388R4, we should bind 't' directly to U{}:
1764 using U = A[2];
1765 A (&&t)[] = {U{}};
1766 because A[] and A[2] are reference-related. But we don't do it
1767 because grok_reference_init has deduced the array size (to 1), and
1768 A[1] and A[2] aren't reference-related. */
1769 if (CONSTRUCTOR_NELTS (expr)(vec_safe_length (((tree_check ((expr), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1769, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
== 1
1770 && !CONSTRUCTOR_IS_DESIGNATED_INIT (expr)(((tree_not_check2 (((tree_check ((expr), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1770, __FUNCTION__, (CONSTRUCTOR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1770, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_6))
)
1771 {
1772 tree elt = CONSTRUCTOR_ELT (expr, 0)(&(*((tree_check ((expr), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1772, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
0])
->value;
1773 if (error_operand_p (elt))
1774 return NULL__null;
1775 tree etype = TREE_TYPE (elt)((contains_struct_check ((elt), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1775, __FUNCTION__))->typed.type)
;
1776 if (reference_related_p (to, etype))
1777 {
1778 expr = elt;
1779 from = etype;
1780 goto skip;
1781 }
1782 }
1783 /* Otherwise, if T is a reference type, a prvalue temporary of the type
1784 referenced by T is copy-list-initialized, and the reference is bound
1785 to that temporary. */
1786 copy_list_init = true;
1787 skip:;
1788 }
1789
1790 if (TYPE_REF_P (from)(((enum tree_code) (from)->base.code) == REFERENCE_TYPE))
1791 {
1792 from = TREE_TYPE (from)((contains_struct_check ((from), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1792, __FUNCTION__))->typed.type)
;
1793 if (!TYPE_REF_IS_RVALUE (rfrom)((tree_check ((rfrom), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1793, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag
)
1794 || TREE_CODE (from)((enum tree_code) (from)->base.code) == FUNCTION_TYPE)
1795 gl_kind = clk_ordinary;
1796 else
1797 gl_kind = clk_rvalueref;
1798 }
1799 else if (expr)
1800 gl_kind = lvalue_kind (expr);
1801 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1801, __FUNCTION__))->type_common.lang_flag_5))
1802 || TREE_CODE (from)((enum tree_code) (from)->base.code) == ARRAY_TYPE)
1803 gl_kind = clk_class;
1804 else
1805 gl_kind = clk_none;
1806
1807 /* Don't allow a class prvalue when LOOKUP_NO_TEMP_BIND. */
1808 if ((flags & LOOKUP_NO_TEMP_BIND(1 << 6))
1809 && (gl_kind & clk_class))
1810 gl_kind = clk_none;
1811
1812 /* Same mask as real_lvalue_p. */
1813 is_lvalue = gl_kind && !(gl_kind & (clk_rvalueref|clk_class));
1814
1815 tfrom = from;
1816 if ((gl_kind & clk_bitfield) != 0)
1817 tfrom = unlowered_expr_type (expr);
1818
1819 /* Figure out whether or not the types are reference-related and
1820 reference compatible. We have to do this after stripping
1821 references from FROM. */
1822 related_p = reference_related_p (to, tfrom);
1823 /* If this is a C cast, first convert to an appropriately qualified
1824 type, so that we can later do a const_cast to the desired type. */
1825 if (related_p && c_cast_p
1826 && !at_least_as_qualified_p (to, tfrom))
1827 to = cp_build_qualified_type (to, cp_type_quals (tfrom));
1828 compatible_p = reference_compatible_p (to, tfrom);
1829
1830 /* Directly bind reference when target expression's type is compatible with
1831 the reference and expression is an lvalue. In DR391, the wording in
1832 [8.5.3/5 dcl.init.ref] is changed to also require direct bindings for
1833 const and rvalue references to rvalues of compatible class type.
1834 We should also do direct bindings for non-class xvalues. */
1835 if ((related_p || compatible_p) && gl_kind)
1836 {
1837 /* [dcl.init.ref]
1838
1839 If the initializer expression
1840
1841 -- is an lvalue (but not an lvalue for a bit-field), and "cv1 T1"
1842 is reference-compatible with "cv2 T2,"
1843
1844 the reference is bound directly to the initializer expression
1845 lvalue.
1846
1847 [...]
1848 If the initializer expression is an rvalue, with T2 a class type,
1849 and "cv1 T1" is reference-compatible with "cv2 T2", the reference
1850 is bound to the object represented by the rvalue or to a sub-object
1851 within that object. */
1852
1853 conv = build_identity_conv (tfrom, expr);
1854 conv = direct_reference_binding (rto, conv);
1855
1856 if (TYPE_REF_P (rfrom)(((enum tree_code) (rfrom)->base.code) == REFERENCE_TYPE))
1857 /* Handle rvalue reference to function properly. */
1858 conv->rvaluedness_matches_p
1859 = (TYPE_REF_IS_RVALUE (rto)((tree_check ((rto), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1859, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag
)
== TYPE_REF_IS_RVALUE (rfrom)((tree_check ((rfrom), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1859, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag
)
);
1860 else
1861 conv->rvaluedness_matches_p
1862 = (TYPE_REF_IS_RVALUE (rto)((tree_check ((rto), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1862, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag
)
== !is_lvalue);
1863
1864 if ((gl_kind & clk_bitfield) != 0
1865 || ((gl_kind & clk_packed) != 0 && !TYPE_PACKED (to)((tree_class_check ((to), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1865, __FUNCTION__))->base.u.bits.packed_flag)
))
1866 /* For the purposes of overload resolution, we ignore the fact
1867 this expression is a bitfield or packed field. (In particular,
1868 [over.ics.ref] says specifically that a function with a
1869 non-const reference parameter is viable even if the
1870 argument is a bitfield.)
1871
1872 However, when we actually call the function we must create
1873 a temporary to which to bind the reference. If the
1874 reference is volatile, or isn't const, then we cannot make
1875 a temporary, so we just issue an error when the conversion
1876 actually occurs. */
1877 conv->need_temporary_p = true;
1878
1879 /* Don't allow binding of lvalues (other than function lvalues) to
1880 rvalue references. */
1881 if (is_lvalue && TYPE_REF_IS_RVALUE (rto)((tree_check ((rto), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1881, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag
)
1882 && TREE_CODE (to)((enum tree_code) (to)->base.code) != FUNCTION_TYPE)
1883 conv->bad_p = true;
1884
1885 /* Nor the reverse. */
1886 if (!is_lvalue && !TYPE_REF_IS_RVALUE (rto)((tree_check ((rto), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1886, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag
)
1887 /* Unless it's really a C++20 lvalue being treated as an xvalue.
1888 But in C++23, such an expression is just an xvalue, not a special
1889 lvalue, so the binding is once again ill-formed. */
1890 && !(cxx_dialect <= cxx20
1891 && (gl_kind & clk_implicit_rval))
1892 && (!CP_TYPE_CONST_NON_VOLATILE_P (to)((cp_type_quals (to) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE
)) == TYPE_QUAL_CONST)
1893 || (flags & LOOKUP_NO_RVAL_BIND(((((((((1 << 6) << 1) << 1) << 1) <<
1) << 1) << 1) << 1) << 1)
))
1894 && TREE_CODE (to)((enum tree_code) (to)->base.code) != FUNCTION_TYPE)
1895 conv->bad_p = true;
1896
1897 if (!compatible_p)
1898 conv->bad_p = true;
1899
1900 return conv;
1901 }
1902 /* [class.conv.fct] A conversion function is never used to convert a
1903 (possibly cv-qualified) object to the (possibly cv-qualified) same
1904 object type (or a reference to it), to a (possibly cv-qualified) base
1905 class of that type (or a reference to it).... */
1906 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1906, __FUNCTION__))->type_common.lang_flag_5))
&& !related_p
1907 && !(flags & LOOKUP_NO_CONVERSION(1 << 4)))
1908 {
1909 /* [dcl.init.ref]
1910
1911 If the initializer expression
1912
1913 -- has a class type (i.e., T2 is a class type) can be
1914 implicitly converted to an lvalue of type "cv3 T3," where
1915 "cv1 T1" is reference-compatible with "cv3 T3". (this
1916 conversion is selected by enumerating the applicable
1917 conversion functions (_over.match.ref_) and choosing the
1918 best one through overload resolution. (_over.match_).
1919
1920 the reference is bound to the lvalue result of the conversion
1921 in the second case. */
1922 z_candidate *cand = build_user_type_conversion_1 (rto, expr, flags,
1923 complain);
1924 if (cand)
1925 return cand->second_conv;
1926 }
1927
1928 /* From this point on, we conceptually need temporaries, even if we
1929 elide them. Only the cases above are "direct bindings". */
1930 if (flags & LOOKUP_NO_TEMP_BIND(1 << 6))
1931 return NULL__null;
1932
1933 /* [over.ics.rank]
1934
1935 When a parameter of reference type is not bound directly to an
1936 argument expression, the conversion sequence is the one required
1937 to convert the argument expression to the underlying type of the
1938 reference according to _over.best.ics_. Conceptually, this
1939 conversion sequence corresponds to copy-initializing a temporary
1940 of the underlying type with the argument expression. Any
1941 difference in top-level cv-qualification is subsumed by the
1942 initialization itself and does not constitute a conversion. */
1943
1944 bool maybe_valid_p = true;
1945
1946 /* [dcl.init.ref]
1947
1948 Otherwise, the reference shall be an lvalue reference to a
1949 non-volatile const type, or the reference shall be an rvalue
1950 reference. */
1951 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 1951, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag
)
)
1952 maybe_valid_p = false;
1953
1954 /* [dcl.init.ref]
1955
1956 Otherwise, a temporary of type "cv1 T1" is created and
1957 initialized from the initializer expression using the rules for a
1958 non-reference copy initialization. If T1 is reference-related to
1959 T2, cv1 must be the same cv-qualification as, or greater
1960 cv-qualification than, cv2; otherwise, the program is ill-formed. */
1961 if (related_p && !at_least_as_qualified_p (to, from))
1962 maybe_valid_p = false;
1963
1964 /* We try below to treat an invalid reference binding as a bad conversion
1965 to improve diagnostics, but doing so may cause otherwise unnecessary
1966 instantiations that can lead to a hard error. So during the first pass
1967 of overload resolution wherein we shortcut bad conversions, instead just
1968 produce a special conversion indicating a second pass is necessary if
1969 there's no strictly viable candidate. */
1970 if (!maybe_valid_p && (flags & LOOKUP_SHORTCUT_BAD_CONVS((((((((((((((((1 << 6) << 1) << 1) <<
1) << 1) << 1) << 1) << 1) << 1
) << 1) << 1) << 1) << 1) << 1)
<< 1) << 1)
))
1971 {
1972 conv = alloc_conversion (ck_deferred_bad);
1973 conv->bad_p = true;
1974 return conv;
1975 }
1976
1977 /* We're generating a temporary now, but don't bind any more in the
1978 conversion (specifically, don't slice the temporary returned by a
1979 conversion operator). */
1980 flags |= LOOKUP_NO_TEMP_BIND(1 << 6);
1981
1982 /* Core issue 899: When [copy-]initializing a temporary to be bound
1983 to the first parameter of a copy constructor (12.8) called with
1984 a single argument in the context of direct-initialization,
1985 explicit conversion functions are also considered.
1986
1987 So don't set LOOKUP_ONLYCONVERTING in that case. */
1988 if (!(flags & LOOKUP_COPY_PARM((((1 << 6) << 1) << 1) << 1)))
1989 flags |= LOOKUP_ONLYCONVERTING(1 << 2);
1990
1991 if (!conv)
1992 conv = implicit_conversion (to, from, expr, c_cast_p,
1993 flags, complain);
1994 if (!conv)
1995 return NULL__null;
1996
1997 if (conv->user_conv_p)
1998 {
1999 if (copy_list_init)
2000 /* Remember this was copy-list-initialization. */
2001 conv->need_temporary_p = true;
2002
2003 /* If initializing the temporary used a conversion function,
2004 recalculate the second conversion sequence. */
2005 for (conversion *t = conv; t; t = next_conversion (t))
2006 if (t->kind == ck_user
2007 && DECL_CONV_FN_P (t->cand->fn)((((tree_not_check2 (((tree_check ((((contains_struct_check (
(t->cand->fn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2007, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2007, __FUNCTION__, (IDENTIFIER_NODE)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2007, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2007, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2007, __FUNCTION__, (IDENTIFIER_NODE)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2007, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2007, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2007, __FUNCTION__, (IDENTIFIER_NODE)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2007, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)))
)
2008 {
2009 tree ftype = TREE_TYPE (TREE_TYPE (t->cand->fn))((contains_struct_check ((((contains_struct_check ((t->cand
->fn), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2009, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2009, __FUNCTION__))->typed.type)
;
2010 /* A prvalue of non-class type is cv-unqualified. */
2011 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2011, __FUNCTION__))->type_common.lang_flag_5))
)
2012 ftype = cv_unqualified (ftype);
2013 int sflags = (flags|LOOKUP_NO_CONVERSION(1 << 4))&~LOOKUP_NO_TEMP_BIND(1 << 6);
2014 conversion *new_second
2015 = reference_binding (rto, ftype, NULL_TREE(tree) __null, c_cast_p,
2016 sflags, complain);
2017 if (!new_second)
2018 return NULL__null;
2019 conv = merge_conversion_sequences (t, new_second);
2020 gcc_assert (maybe_valid_p || conv->bad_p)((void)(!(maybe_valid_p || conv->bad_p) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2020, __FUNCTION__), 0 : 0))
;
2021 return conv;
2022 }
2023 }
2024
2025 conv = build_conv (ck_ref_bind, rto, conv);
2026 /* This reference binding, unlike those above, requires the
2027 creation of a temporary. */
2028 conv->need_temporary_p = true;
2029 conv->rvaluedness_matches_p = TYPE_REF_IS_RVALUE (rto)((tree_check ((rto), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2029, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag
)
;
2030 conv->bad_p |= !maybe_valid_p;
2031
2032 return conv;
2033}
2034
2035/* Most of the implementation of implicit_conversion, with the same
2036 parameters. */
2037
2038static conversion *
2039implicit_conversion_1 (tree to, tree from, tree expr, bool c_cast_p,
2040 int flags, tsubst_flags_t complain)
2041{
2042 conversion *conv;
2043
2044 if (from == error_mark_nodeglobal_trees[TI_ERROR_MARK] || to == error_mark_nodeglobal_trees[TI_ERROR_MARK]
2045 || expr == error_mark_nodeglobal_trees[TI_ERROR_MARK])
2046 return NULL__null;
2047
2048 /* Other flags only apply to the primary function in overload
2049 resolution, or after we've chosen one. */
2050 flags &= (LOOKUP_ONLYCONVERTING(1 << 2)|LOOKUP_NO_CONVERSION(1 << 4)|LOOKUP_COPY_PARM((((1 << 6) << 1) << 1) << 1)
2051 |LOOKUP_NO_TEMP_BIND(1 << 6)|LOOKUP_NO_RVAL_BIND(((((((((1 << 6) << 1) << 1) << 1) <<
1) << 1) << 1) << 1) << 1)
|LOOKUP_NO_NARROWING((1 << 6) << 1)
2052 |LOOKUP_PROTECT(1 << 0)|LOOKUP_NO_NON_INTEGRAL((((((((((1 << 6) << 1) << 1) << 1) <<
1) << 1) << 1) << 1) << 1) << 1
)
|LOOKUP_SHORTCUT_BAD_CONVS((((((((((((((((1 << 6) << 1) << 1) <<
1) << 1) << 1) << 1) << 1) << 1
) << 1) << 1) << 1) << 1) << 1)
<< 1) << 1)
);
2053
2054 /* FIXME: actually we don't want warnings either, but we can't just
2055 have 'complain &= ~(tf_warning|tf_error)' because it would cause
2056 the regression of, eg, g++.old-deja/g++.benjamin/16077.C.
2057 We really ought not to issue that warning until we've committed
2058 to that conversion. */
2059 complain &= ~tf_error;
2060
2061 /* Call reshape_init early to remove redundant braces. */
2062 if (expr && BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2062, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
2063 && 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2063, __FUNCTION__))->type_common.lang_flag_5))
2064 && COMPLETE_TYPE_P (complete_type (to))(((tree_class_check ((complete_type (to)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2064, __FUNCTION__))->type_common.size) != (tree) __null
)
2065 && !CLASSTYPE_NON_AGGREGATE (to)((((tree_class_check ((to), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2065, __FUNCTION__))->type_with_lang_specific.lang_specific
))->non_aggregate)
)
2066 {
2067 expr = reshape_init (to, expr, complain);
2068 if (expr == error_mark_nodeglobal_trees[TI_ERROR_MARK])
2069 return NULL__null;
2070 from = TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2070, __FUNCTION__))->typed.type)
;
2071 }
2072
2073 if (TYPE_REF_P (to)(((enum tree_code) (to)->base.code) == REFERENCE_TYPE))
2074 conv = reference_binding (to, from, expr, c_cast_p, flags, complain);
2075 else
2076 conv = standard_conversion (to, from, expr, c_cast_p, flags, complain);
2077
2078 if (conv)
2079 return conv;
2080
2081 if (expr && BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2081, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
)
2082 {
2083 if (is_std_init_list (to) && !CONSTRUCTOR_IS_DESIGNATED_INIT (expr)(((tree_not_check2 (((tree_check ((expr), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2083, __FUNCTION__, (CONSTRUCTOR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2083, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_6))
)
2084 return build_list_conv (to, expr, flags, complain);
2085
2086 /* As an extension, allow list-initialization of _Complex. */
2087 if (TREE_CODE (to)((enum tree_code) (to)->base.code) == COMPLEX_TYPE
2088 && !CONSTRUCTOR_IS_DESIGNATED_INIT (expr)(((tree_not_check2 (((tree_check ((expr), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2088, __FUNCTION__, (CONSTRUCTOR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2088, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_6))
)
2089 {
2090 conv = build_complex_conv (to, expr, flags, complain);
2091 if (conv)
2092 return conv;
2093 }
2094
2095 /* Allow conversion from an initializer-list with one element to a
2096 scalar type. */
2097 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2097, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2097, __FUNCTION__))->type_common.lang_flag_2))) || (((enum
tree_code) (to)->base.code) == NULLPTR_TYPE))
)
2098 {
2099 int nelts = CONSTRUCTOR_NELTS (expr)(vec_safe_length (((tree_check ((expr), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2099, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
;
2100 tree elt;
2101
2102 if (nelts == 0)
2103 elt = build_value_init (to, tf_none);
2104 else if (nelts == 1 && !CONSTRUCTOR_IS_DESIGNATED_INIT (expr)(((tree_not_check2 (((tree_check ((expr), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2104, __FUNCTION__, (CONSTRUCTOR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2104, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_6))
)
2105 elt = CONSTRUCTOR_ELT (expr, 0)(&(*((tree_check ((expr), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2105, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
0])
->value;
2106 else
2107 elt = error_mark_nodeglobal_trees[TI_ERROR_MARK];
2108
2109 conv = implicit_conversion (to, TREE_TYPE (elt)((contains_struct_check ((elt), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2109, __FUNCTION__))->typed.type)
, elt,
2110 c_cast_p, flags, complain);
2111 if (conv)
2112 {
2113 conv->check_narrowing = true;
2114 if (BRACE_ENCLOSED_INITIALIZER_P (elt)(((enum tree_code) (elt)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((elt), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2114, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
)
2115 /* Too many levels of braces, i.e. '{{1}}'. */
2116 conv->bad_p = true;
2117 return conv;
2118 }
2119 }
2120 else if (TREE_CODE (to)((enum tree_code) (to)->base.code) == ARRAY_TYPE)
2121 return build_array_conv (to, expr, flags, complain);
2122 }
2123
2124 if (expr != NULL_TREE(tree) __null
2125 && (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) == TRAIT_TYPE || ((enum
tree_code) (from)->base.code) == DEPENDENT_OPERATOR_TYPE)
|| (((((enum tree_code) (from)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (from)->base.code)) == UNION_TYPE) &&
((tree_class_check ((from), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2125, __FUNCTION__))->type_common.lang_flag_5)))
2126 || 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) == TRAIT_TYPE || ((enum
tree_code) (to)->base.code) == DEPENDENT_OPERATOR_TYPE) ||
(((((enum tree_code) (to)->base.code)) == RECORD_TYPE || (
((enum tree_code) (to)->base.code)) == UNION_TYPE) &&
((tree_class_check ((to), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2126, __FUNCTION__))->type_common.lang_flag_5)))
)
2127 && (flags & LOOKUP_NO_CONVERSION(1 << 4)) == 0)
2128 {
2129 struct z_candidate *cand;
2130
2131 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2131, __FUNCTION__))->type_common.lang_flag_5))
2132 && BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2132, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
2133 && !CLASSTYPE_NON_AGGREGATE (complete_type (to))((((tree_class_check ((complete_type (to)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2133, __FUNCTION__))->type_with_lang_specific.lang_specific
))->non_aggregate)
)
2134 return build_aggr_conv (to, expr, flags, complain);
2135
2136 cand = build_user_type_conversion_1 (to, expr, flags, complain);
2137 if (cand)
2138 {
2139 if (BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2139, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
2140 && CONSTRUCTOR_NELTS (expr)(vec_safe_length (((tree_check ((expr), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2140, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
== 1
2141 && !CONSTRUCTOR_IS_DESIGNATED_INIT (expr)(((tree_not_check2 (((tree_check ((expr), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2141, __FUNCTION__, (CONSTRUCTOR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2141, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_6))
2142 && !is_list_ctor (cand->fn))
2143 {
2144 /* "If C is not an initializer-list constructor and the
2145 initializer list has a single element of type cv U, where U is
2146 X or a class derived from X, the implicit conversion sequence
2147 has Exact Match rank if U is X, or Conversion rank if U is
2148 derived from X." */
2149 tree elt = CONSTRUCTOR_ELT (expr, 0)(&(*((tree_check ((expr), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2149, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
0])
->value;
2150 tree elttype = TREE_TYPE (elt)((contains_struct_check ((elt), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2150, __FUNCTION__))->typed.type)
;
2151 if (reference_related_p (to, elttype))
2152 return implicit_conversion (to, elttype, elt,
2153 c_cast_p, flags, complain);
2154 }
2155 conv = cand->second_conv;
2156 }
2157
2158 /* We used to try to bind a reference to a temporary here, but that
2159 is now handled after the recursive call to this function at the end
2160 of reference_binding. */
2161 return conv;
2162 }
2163
2164 return NULL__null;
2165}
2166
2167/* Returns the implicit conversion sequence (see [over.ics]) from type
2168 FROM to type TO. The optional expression EXPR may affect the
2169 conversion. FLAGS are the usual overloading flags. If C_CAST_P is
2170 true, this conversion is coming from a C-style cast. */
2171
2172static conversion *
2173implicit_conversion (tree to, tree from, tree expr, bool c_cast_p,
2174 int flags, tsubst_flags_t complain)
2175{
2176 conversion *conv = implicit_conversion_1 (to, from, expr, c_cast_p,
2177 flags, complain);
2178 if (!conv || conv->bad_p)
2179 return conv;
2180 if (conv_is_prvalue (conv)
2181 && 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),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2181, __FUNCTION__))->type_common.lang_flag_5))
2182 && CLASSTYPE_PURE_VIRTUALS (conv->type)((((tree_class_check ((conv->type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2182, __FUNCTION__))->type_with_lang_specific.lang_specific
))->pure_virtuals)
)
2183 conv->bad_p = true;
2184 return conv;
2185}
2186
2187/* Like implicit_conversion, but return NULL if the conversion is bad.
2188
2189 This is not static so that check_non_deducible_conversion can call it within
2190 add_template_candidate_real as part of overload resolution; it should not be
2191 called outside of overload resolution. */
2192
2193conversion *
2194good_conversion (tree to, tree from, tree expr,
2195 int flags, tsubst_flags_t complain)
2196{
2197 conversion *c = implicit_conversion (to, from, expr, /*cast*/false,
2198 flags, complain);
2199 if (c && c->bad_p)
2200 c = NULL__null;
2201 return c;
2202}
2203
2204/* Add a new entry to the list of candidates. Used by the add_*_candidate
2205 functions. ARGS will not be changed until a single candidate is
2206 selected. */
2207
2208static struct z_candidate *
2209add_candidate (struct z_candidate **candidates,
2210 tree fn, tree first_arg, const vec<tree, va_gc> *args,
2211 size_t num_convs, conversion **convs,
2212 tree access_path, tree conversion_path,
2213 int viable, struct rejection_reason *reason,
2214 int flags)
2215{
2216 struct z_candidate *cand = (struct z_candidate *)
2217 conversion_obstack_alloc (sizeof (struct z_candidate));
2218
2219 cand->fn = fn;
2220 cand->first_arg = first_arg;
2221 cand->args = args;
2222 cand->convs = convs;
2223 cand->num_convs = num_convs;
2224 cand->access_path = access_path;
2225 cand->conversion_path = conversion_path;
2226 cand->viable = viable;
2227 cand->reason = reason;
2228 cand->next = *candidates;
2229 cand->flags = flags;
2230 *candidates = cand;
2231
2232 if (convs && cand->reversed ())
2233 /* Swap the conversions for comparison in joust; we'll swap them back
2234 before build_over_call. */
2235 std::swap (convs[0], convs[1]);
2236
2237 return cand;
2238}
2239
2240/* Return the number of remaining arguments in the parameter list
2241 beginning with ARG. */
2242
2243int
2244remaining_arguments (tree arg)
2245{
2246 int n;
2247
2248 for (n = 0; arg != NULL_TREE(tree) __null && arg != void_list_nodeglobal_trees[TI_VOID_LIST_NODE];
2249 arg = TREE_CHAIN (arg)((contains_struct_check ((arg), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2249, __FUNCTION__))->common.chain)
)
2250 n++;
2251
2252 return n;
2253}
2254
2255/* [over.match.copy]: When initializing a temporary object (12.2) to be bound
2256 to the first parameter of a constructor where the parameter is of type
2257 "reference to possibly cv-qualified T" and the constructor is called with a
2258 single argument in the context of direct-initialization of an object of type
2259 "cv2 T", explicit conversion functions are also considered.
2260
2261 So set LOOKUP_COPY_PARM to let reference_binding know that
2262 it's being called in that context. */
2263
2264int
2265conv_flags (int i, int nargs, tree fn, tree arg, int flags)
2266{
2267 int lflags = flags;
2268 tree t;
2269 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2269, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2269, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
2270 && (t = FUNCTION_FIRST_USER_PARMTYPE (fn)skip_artificial_parms_for ((fn), ((tree_check2 ((((contains_struct_check
((fn), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2270, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2270, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values))
)
2271 && (same_type_ignoring_top_level_qualifiers_p
2272 (non_reference (TREE_VALUE (t)((tree_check ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2272, __FUNCTION__, (TREE_LIST)))->list.value)
), DECL_CONTEXT (fn)((contains_struct_check ((fn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2272, __FUNCTION__))->decl_minimal.context)
)))
2273 {
2274 if (!(flags & LOOKUP_ONLYCONVERTING(1 << 2)))
2275 lflags |= LOOKUP_COPY_PARM((((1 << 6) << 1) << 1) << 1);
2276 if ((flags & LOOKUP_LIST_INIT_CTOR(((1 << 6) << 1) << 1))
2277 && BRACE_ENCLOSED_INITIALIZER_P (arg)(((enum tree_code) (arg)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((arg), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2277, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
)
2278 lflags |= LOOKUP_NO_CONVERSION(1 << 4);
2279 }
2280 else
2281 lflags |= LOOKUP_ONLYCONVERTING(1 << 2);
2282
2283 return lflags;
2284}
2285
2286/* Build an appropriate 'this' conversion for the method FN and class
2287 type CTYPE from the value ARG (having type ARGTYPE) to the type PARMTYPE.
2288 This function modifies PARMTYPE, ARGTYPE and ARG. */
2289
2290static conversion *
2291build_this_conversion (tree fn, tree ctype,
2292 tree& parmtype, tree& argtype, tree& arg,
2293 int flags, tsubst_flags_t complain)
2294{
2295 gcc_assert (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)((void)(!((((enum tree_code) (((contains_struct_check ((fn), (
TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2295, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
) && !((tree_check (((((enum tree_code) (fn)->base
.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast
<union tree_node *> ((((tree_check ((fn), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2296, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2296, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2296, __FUNCTION__), 0 : 0))
2296 && !DECL_CONSTRUCTOR_P (fn))((void)(!((((enum tree_code) (((contains_struct_check ((fn), (
TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2295, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
) && !((tree_check (((((enum tree_code) (fn)->base
.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast
<union tree_node *> ((((tree_check ((fn), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2296, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2296, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2296, __FUNCTION__), 0 : 0))
;
2297
2298 /* The type of the implicit object parameter ('this') for
2299 overload resolution is not always the same as for the
2300 function itself; conversion functions are considered to
2301 be members of the class being converted, and functions
2302 introduced by a using-declaration are considered to be
2303 members of the class that uses them.
2304
2305 Since build_over_call ignores the ICS for the `this'
2306 parameter, we can just change the parm type. */
2307 parmtype = cp_build_qualified_type (ctype,
2308 cp_type_quals (TREE_TYPE (parmtype)((contains_struct_check ((parmtype), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2308, __FUNCTION__))->typed.type)
));
2309 bool this_p = true;
2310 if (FUNCTION_REF_QUALIFIED (TREE_TYPE (fn))((tree_not_check2 (((tree_check2 ((((contains_struct_check ((
fn), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2310, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2310, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2310, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_4)
)
2311 {
2312 /* If the function has a ref-qualifier, the implicit
2313 object parameter has reference type. */
2314 bool rv = FUNCTION_RVALUE_QUALIFIED (TREE_TYPE (fn))((tree_not_check2 (((tree_check2 ((((contains_struct_check ((
fn), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2314, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2314, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2314, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_5)
;
2315 parmtype = cp_build_reference_type (parmtype, rv);
2316 /* The special handling of 'this' conversions in compare_ics
2317 does not apply if there is a ref-qualifier. */
2318 this_p = false;
2319 }
2320 else
2321 {
2322 parmtype = build_pointer_type (parmtype);
2323 /* We don't use build_this here because we don't want to
2324 capture the object argument until we've chosen a
2325 non-static member function. */
2326 arg = build_address (arg);
2327 argtype = lvalue_type (arg);
2328 }
2329 flags |= LOOKUP_ONLYCONVERTING(1 << 2);
2330 conversion *t = implicit_conversion (parmtype, argtype, arg,
2331 /*c_cast_p=*/false, flags, complain);
2332 t->this_p = this_p;
2333 return t;
2334}
2335
2336/* Create an overload candidate for the function or method FN called
2337 with the argument list FIRST_ARG/ARGS and add it to CANDIDATES.
2338 FLAGS is passed on to implicit_conversion.
2339
2340 This does not change ARGS.
2341
2342 CTYPE, if non-NULL, is the type we want to pretend this function
2343 comes from for purposes of overload resolution.
2344
2345 SHORTCUT_BAD_CONVS controls how we handle "bad" argument conversions.
2346 If true, we stop computing conversions upon seeing the first bad
2347 conversion. This is used by add_candidates to avoid computing
2348 more conversions than necessary in the presence of a strictly viable
2349 candidate, while preserving the defacto behavior of overload resolution
2350 when it turns out there are only non-strictly viable candidates. */
2351
2352static struct z_candidate *
2353add_function_candidate (struct z_candidate **candidates,
2354 tree fn, tree ctype, tree first_arg,
2355 const vec<tree, va_gc> *args, tree access_path,
2356 tree conversion_path, int flags,
2357 conversion **convs,
2358 bool shortcut_bad_convs,
2359 tsubst_flags_t complain)
2360{
2361 tree parmlist = TYPE_ARG_TYPES (TREE_TYPE (fn))((tree_check2 ((((contains_struct_check ((fn), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2361, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2361, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)
;
2362 int i, len;
2363 tree parmnode;
2364 tree orig_first_arg = first_arg;
2365 int skip;
2366 int viable = 1;
2367 struct rejection_reason *reason = NULL__null;
2368
2369 /* The `this', `in_chrg' and VTT arguments to constructors are not
2370 considered in overload resolution. */
2371 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2371, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2371, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
)
2372 {
2373 if (ctor_omit_inherited_parms (fn))
2374 /* Bring back parameters omitted from an inherited ctor. */
2375 parmlist = FUNCTION_FIRST_USER_PARMTYPE (DECL_ORIGIN (fn))skip_artificial_parms_for (((((contains_struct_check ((fn), (
TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2375, __FUNCTION__))->decl_common.abstract_origin) ? ((contains_struct_check
((fn), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2375, __FUNCTION__))->decl_common.abstract_origin) : (fn
))), ((tree_check2 ((((contains_struct_check (((((contains_struct_check
((fn), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2375, __FUNCTION__))->decl_common.abstract_origin) ? ((contains_struct_check
((fn), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2375, __FUNCTION__))->decl_common.abstract_origin) : (fn
))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2375, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2375, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values))
;
2376 else
2377 parmlist = skip_artificial_parms_for (fn, parmlist);
2378 skip = num_artificial_parms_for (fn);
2379 if (skip > 0 && first_arg != NULL_TREE(tree) __null)
2380 {
2381 --skip;
2382 first_arg = NULL_TREE(tree) __null;
2383 }
2384 }
2385 else
2386 skip = 0;
2387
2388 len = vec_safe_length (args) - skip + (first_arg != NULL_TREE(tree) __null ? 1 : 0);
2389 if (!convs)
2390 convs = alloc_conversions (len);
2391
2392 /* 13.3.2 - Viable functions [over.match.viable]
2393 First, to be a viable function, a candidate function shall have enough
2394 parameters to agree in number with the arguments in the list.
2395
2396 We need to check this first; otherwise, checking the ICSes might cause
2397 us to produce an ill-formed template instantiation. */
2398
2399 parmnode = parmlist;
2400 for (i = 0; i < len; ++i)
2401 {
2402 if (parmnode == NULL_TREE(tree) __null || parmnode == void_list_nodeglobal_trees[TI_VOID_LIST_NODE])
2403 break;
2404 parmnode = TREE_CHAIN (parmnode)((contains_struct_check ((parmnode), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2404, __FUNCTION__))->common.chain)
;
2405 }
2406
2407 if ((i < len && parmnode)
2408 || !sufficient_parms_p (parmnode))
2409 {
2410 int remaining = remaining_arguments (parmnode);
2411 viable = 0;
2412 reason = arity_rejection (first_arg, i + remaining, len);
2413 }
2414
2415 /* An inherited constructor (12.6.3 [class.inhctor.init]) that has a first
2416 parameter of type "reference to cv C" (including such a constructor
2417 instantiated from a template) is excluded from the set of candidate
2418 functions when used to construct an object of type D with an argument list
2419 containing a single argument if C is reference-related to D. */
2420 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2420, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2420, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
2421 && flag_new_inheriting_ctorsglobal_options.x_flag_new_inheriting_ctors
2422 && 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2422, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2422, __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),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2422, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2422, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2422, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2422, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2422, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2422, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2422, __FUNCTION__); &lt->u.fn; })->context : (tree
) __null)
)
2423 {
2424 tree ptype = non_reference (TREE_VALUE (parmlist)((tree_check ((parmlist), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2424, __FUNCTION__, (TREE_LIST)))->list.value)
);
2425 tree dtype = DECL_CONTEXT (fn)((contains_struct_check ((fn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2425, __FUNCTION__))->decl_minimal.context)
;
2426 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2426, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2426, __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),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2426, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2426, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2426, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2426, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2426, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2426, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2426, __FUNCTION__); &lt->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),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2426, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2426, __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),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2426, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2426, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2426, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2426, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2426, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2426, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2426, __FUNCTION__); &lt->u.fn; })->context : (tree
) __null)), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2426, __FUNCTION__))->decl_minimal.context) : (tree) __null
)
;
2427 if (reference_related_p (ptype, dtype)
2428 && reference_related_p (btype, ptype))
2429 {
2430 viable = false;
2431 reason = inherited_ctor_rejection ();
2432 }
2433 }
2434
2435 /* Second, for a function to be viable, its constraints must be
2436 satisfied. */
2437 if (flag_conceptsglobal_options.x_flag_concepts && viable && !constraints_satisfied_p (fn))
2438 {
2439 reason = constraint_failure ();
2440 viable = false;
2441 }
2442
2443 /* When looking for a function from a subobject from an implicit
2444 copy/move constructor/operator=, don't consider anything that takes (a
2445 reference to) an unrelated type. See c++/44909 and core 1092. */
2446 if (viable && parmlist && (flags & LOOKUP_DEFAULTED(((((((1 << 6) << 1) << 1) << 1) <<
1) << 1) << 1)
))
2447 {
2448 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2448, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2448, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
)
2449 i = 1;
2450 else if (DECL_ASSIGNMENT_OPERATOR_P (fn)(((((tree_not_check2 (((tree_check ((((contains_struct_check (
(fn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2450, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2450, __FUNCTION__, (IDENTIFIER_NODE)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2450, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2)) & (!((tree_not_check2 (((tree_check ((((contains_struct_check
((fn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2450, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2450, __FUNCTION__, (IDENTIFIER_NODE)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2450, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_1))) & ((tree_not_check2 (((tree_check ((((contains_struct_check
((fn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2450, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2450, __FUNCTION__, (IDENTIFIER_NODE)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2450, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0))
2451 && 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2451, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2451, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2451, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2451, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2451, __FUNCTION__); &lt->u.fn; })->ovl_op_code) ==
OVL_OP_NOP_EXPR)
)
2452 i = 2;
2453 else
2454 i = 0;
2455 if (i && len == i)
2456 {
2457 parmnode = chain_index (i-1, parmlist);
2458 if (!reference_related_p (non_reference (TREE_VALUE (parmnode)((tree_check ((parmnode), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2458, __FUNCTION__, (TREE_LIST)))->list.value)
),
2459 ctype))
2460 viable = 0;
2461 }
2462
2463 /* This only applies at the top level. */
2464 flags &= ~LOOKUP_DEFAULTED(((((((1 << 6) << 1) << 1) << 1) <<
1) << 1) << 1)
;
2465 }
2466
2467 if (! viable)
2468 goto out;
2469
2470 if (shortcut_bad_convs)
2471 flags |= LOOKUP_SHORTCUT_BAD_CONVS((((((((((((((((1 << 6) << 1) << 1) <<
1) << 1) << 1) << 1) << 1) << 1
) << 1) << 1) << 1) << 1) << 1)
<< 1) << 1)
;
2472 else
2473 flags &= ~LOOKUP_SHORTCUT_BAD_CONVS((((((((((((((((1 << 6) << 1) << 1) <<
1) << 1) << 1) << 1) << 1) << 1
) << 1) << 1) << 1) << 1) << 1)
<< 1) << 1)
;
2474
2475 /* Third, for F to be a viable function, there shall exist for each
2476 argument an implicit conversion sequence that converts that argument
2477 to the corresponding parameter of F. */
2478
2479 parmnode = parmlist;
2480
2481 for (i = 0; i < len; ++i)
2482 {
2483 tree argtype, to_type;
2484 tree arg;
2485
2486 if (parmnode == void_list_nodeglobal_trees[TI_VOID_LIST_NODE])
2487 break;
2488
2489 if (convs[i])
2490 {
2491 /* Already set during deduction. */
2492 parmnode = TREE_CHAIN (parmnode)((contains_struct_check ((parmnode), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2492, __FUNCTION__))->common.chain)
;
2493 continue;
2494 }
2495
2496 if (i == 0 && first_arg != NULL_TREE(tree) __null)
2497 arg = first_arg;
2498 else
2499 arg = CONST_CAST_TREE ((const_cast<union tree_node *> ((((*args)[i + skip - (first_arg
!= (tree) __null ? 1 : 0)]))))
2500 (*args)[i + skip - (first_arg != NULL_TREE ? 1 : 0)])(const_cast<union tree_node *> ((((*args)[i + skip - (first_arg
!= (tree) __null ? 1 : 0)]))))
;
2501 argtype = lvalue_type (arg);
2502
2503 conversion *t;
2504 if (parmnode)
2505 {
2506 tree parmtype = TREE_VALUE (parmnode)((tree_check ((parmnode), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2506, __FUNCTION__, (TREE_LIST)))->list.value)
;
2507 if (i == 0
2508 && DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)(((enum tree_code) (((contains_struct_check ((fn), (TS_TYPED)
, "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2508, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)
2509 && !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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2509, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2509, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
)
2510 t = build_this_conversion (fn, ctype, parmtype, argtype, arg,
2511 flags, complain);
2512 else
2513 {
2514 int lflags = conv_flags (i, len-skip, fn, arg, flags);
2515 t = implicit_conversion (parmtype, argtype, arg,
2516 /*c_cast_p=*/false, lflags, complain);
2517 }
2518 to_type = parmtype;
2519 parmnode = TREE_CHAIN (parmnode)((contains_struct_check ((parmnode), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2519, __FUNCTION__))->common.chain)
;
2520 }
2521 else
2522 {
2523 t = build_identity_conv (argtype, arg);
2524 t->ellipsis_p = true;
2525 to_type = argtype;
2526 }
2527
2528 convs[i] = t;
2529 if (! t)
2530 {
2531 viable = 0;
2532 reason = arg_conversion_rejection (first_arg, i, argtype, to_type,
2533 EXPR_LOCATION (arg)((((arg)) && ((tree_code_type_tmpl <0>::tree_code_type
[(int) (((enum tree_code) ((arg))->base.code))]) >= tcc_reference
&& (tree_code_type_tmpl <0>::tree_code_type[(int
) (((enum tree_code) ((arg))->base.code))]) <= tcc_expression
)) ? (arg)->exp.locus : ((location_t) 0))
);
2534 break;
2535 }
2536
2537 if (t->bad_p)
2538 {
2539 viable = -1;
2540 reason = bad_arg_conversion_rejection (first_arg, i, arg, to_type,
2541 EXPR_LOCATION (arg)((((arg)) && ((tree_code_type_tmpl <0>::tree_code_type
[(int) (((enum tree_code) ((arg))->base.code))]) >= tcc_reference
&& (tree_code_type_tmpl <0>::tree_code_type[(int
) (((enum tree_code) ((arg))->base.code))]) <= tcc_expression
)) ? (arg)->exp.locus : ((location_t) 0))
);
2542 if (shortcut_bad_convs)
2543 break;
2544 }
2545 }
2546
2547 out:
2548 return add_candidate (candidates, fn, orig_first_arg, args, len, convs,
2549 access_path, conversion_path, viable, reason, flags);
2550}
2551
2552/* Create an overload candidate for the conversion function FN which will
2553 be invoked for expression OBJ, producing a pointer-to-function which
2554 will in turn be called with the argument list FIRST_ARG/ARGLIST,
2555 and add it to CANDIDATES. This does not change ARGLIST. FLAGS is
2556 passed on to implicit_conversion.
2557
2558 Actually, we don't really care about FN; we care about the type it
2559 converts to. There may be multiple conversion functions that will
2560 convert to that type, and we rely on build_user_type_conversion_1 to
2561 choose the best one; so when we create our candidate, we record the type
2562 instead of the function. */
2563
2564static struct z_candidate *
2565add_conv_candidate (struct z_candidate **candidates, tree fn, tree obj,
2566 const vec<tree, va_gc> *arglist,
2567 tree access_path, tree conversion_path,
2568 tsubst_flags_t complain)
2569{
2570 tree totype = TREE_TYPE (TREE_TYPE (fn))((contains_struct_check ((((contains_struct_check ((fn), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2570, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2570, __FUNCTION__))->typed.type)
;
2571 int i, len, viable, flags;
2572 tree parmlist, parmnode;
2573 conversion **convs;
2574 struct rejection_reason *reason;
2575
2576 for (parmlist = totype; TREE_CODE (parmlist)((enum tree_code) (parmlist)->base.code) != FUNCTION_TYPE; )
2577 parmlist = TREE_TYPE (parmlist)((contains_struct_check ((parmlist), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2577, __FUNCTION__))->typed.type)
;
2578 parmlist = TYPE_ARG_TYPES (parmlist)((tree_check2 ((parmlist), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2578, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)
;
2579
2580 len = vec_safe_length (arglist) + 1;
2581 convs = alloc_conversions (len);
2582 parmnode = parmlist;
2583 viable = 1;
2584 flags = LOOKUP_IMPLICIT(((1 << 0)) | (1 << 2));
2585 reason = NULL__null;
2586
2587 /* Don't bother looking up the same type twice. */
2588 if (*candidates && (*candidates)->fn == totype)
2589 return NULL__null;
2590
2591 for (i = 0; i < len; ++i)
2592 {
2593 tree arg, argtype, convert_type = NULL_TREE(tree) __null;
2594 conversion *t;
2595
2596 if (i == 0)
2597 arg = obj;
2598 else
2599 arg = (*arglist)[i - 1];
2600 argtype = lvalue_type (arg);
2601
2602 if (i == 0)
2603 {
2604 t = build_identity_conv (argtype, NULL_TREE(tree) __null);
2605 t = build_conv (ck_user, totype, t);
2606 /* Leave the 'cand' field null; we'll figure out the conversion in
2607 convert_like if this candidate is chosen. */
2608 convert_type = totype;
2609 }
2610 else if (parmnode == void_list_nodeglobal_trees[TI_VOID_LIST_NODE])
2611 break;
2612 else if (parmnode)
2613 {
2614 t = implicit_conversion (TREE_VALUE (parmnode)((tree_check ((parmnode), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2614, __FUNCTION__, (TREE_LIST)))->list.value)
, argtype, arg,
2615 /*c_cast_p=*/false, flags, complain);
2616 convert_type = TREE_VALUE (parmnode)((tree_check ((parmnode), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2616, __FUNCTION__, (TREE_LIST)))->list.value)
;
2617 }
2618 else
2619 {
2620 t = build_identity_conv (argtype, arg);
2621 t->ellipsis_p = true;
2622 convert_type = argtype;
2623 }
2624
2625 convs[i] = t;
2626 if (! t)
2627 break;
2628
2629 if (t->bad_p)
2630 {
2631 viable = -1;
2632 reason = bad_arg_conversion_rejection (NULL_TREE(tree) __null, i, arg, convert_type,
2633 EXPR_LOCATION (arg)((((arg)) && ((tree_code_type_tmpl <0>::tree_code_type
[(int) (((enum tree_code) ((arg))->base.code))]) >= tcc_reference
&& (tree_code_type_tmpl <0>::tree_code_type[(int
) (((enum tree_code) ((arg))->base.code))]) <= tcc_expression
)) ? (arg)->exp.locus : ((location_t) 0))
);
2634 }
2635
2636 if (i == 0)
2637 continue;
2638
2639 if (parmnode)
2640 parmnode = TREE_CHAIN (parmnode)((contains_struct_check ((parmnode), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2640, __FUNCTION__))->common.chain)
;
2641 }
2642
2643 if (i < len
2644 || ! sufficient_parms_p (parmnode))
2645 {
2646 int remaining = remaining_arguments (parmnode);
2647 viable = 0;
2648 reason = arity_rejection (NULL_TREE(tree) __null, i + remaining, len);
2649 }
2650
2651 return add_candidate (candidates, totype, obj, arglist, len, convs,
2652 access_path, conversion_path, viable, reason, flags);
2653}
2654
2655static void
2656build_builtin_candidate (struct z_candidate **candidates, tree fnname,
2657 tree type1, tree type2, const vec<tree,va_gc> &args,
2658 tree *argtypes, int flags, tsubst_flags_t complain)
2659{
2660 conversion *t;
2661 conversion **convs;
2662 size_t num_convs;
2663 int viable = 1;
2664 tree types[2];
2665 struct rejection_reason *reason = NULL__null;
2666
2667 types[0] = type1;
2668 types[1] = type2;
2669
2670 num_convs = args.length ();
2671 convs = alloc_conversions (num_convs);
2672
2673 /* TRUTH_*_EXPR do "contextual conversion to bool", which means explicit
2674 conversion ops are allowed. We handle that here by just checking for
2675 boolean_type_node because other operators don't ask for it. COND_EXPR
2676 also does contextual conversion to bool for the first operand, but we
2677 handle that in build_conditional_expr, and type1 here is operand 2. */
2678 if (type1 != boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE])
2679 flags |= LOOKUP_ONLYCONVERTING(1 << 2);
2680
2681 for (unsigned i = 0; i < 2 && i < num_convs; ++i)
2682 {
2683 t = implicit_conversion (types[i], argtypes[i], args[i],
2684 /*c_cast_p=*/false, flags, complain);
2685 if (! t)
2686 {
2687 viable = 0;
2688 /* We need something for printing the candidate. */
2689 t = build_identity_conv (types[i], NULL_TREE(tree) __null);
2690 reason = arg_conversion_rejection (NULL_TREE(tree) __null, i, argtypes[i],
2691 types[i], EXPR_LOCATION (args[i])((((args[i])) && ((tree_code_type_tmpl <0>::tree_code_type
[(int) (((enum tree_code) ((args[i]))->base.code))]) >=
tcc_reference && (tree_code_type_tmpl <0>::tree_code_type
[(int) (((enum tree_code) ((args[i]))->base.code))]) <=
tcc_expression)) ? (args[i])->exp.locus : ((location_t) 0
))
);
2692 }
2693 else if (t->bad_p)
2694 {
2695 viable = 0;
2696 reason = bad_arg_conversion_rejection (NULL_TREE(tree) __null, i, args[i],
2697 types[i],
2698 EXPR_LOCATION (args[i])((((args[i])) && ((tree_code_type_tmpl <0>::tree_code_type
[(int) (((enum tree_code) ((args[i]))->base.code))]) >=
tcc_reference && (tree_code_type_tmpl <0>::tree_code_type
[(int) (((enum tree_code) ((args[i]))->base.code))]) <=
tcc_expression)) ? (args[i])->exp.locus : ((location_t) 0
))
);
2699 }
2700 convs[i] = t;
2701 }
2702
2703 /* For COND_EXPR we rearranged the arguments; undo that now. */
2704 if (num_convs == 3)
2705 {
2706 convs[2] = convs[1];
2707 convs[1] = convs[0];
2708 t = implicit_conversion (boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], argtypes[2], args[2],
2709 /*c_cast_p=*/false, flags,
2710 complain);
2711 if (t)
2712 convs[0] = t;
2713 else
2714 {
2715 viable = 0;
2716 reason = arg_conversion_rejection (NULL_TREE(tree) __null, 0, argtypes[2],
2717 boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE],
2718 EXPR_LOCATION (args[2])((((args[2])) && ((tree_code_type_tmpl <0>::tree_code_type
[(int) (((enum tree_code) ((args[2]))->base.code))]) >=
tcc_reference && (tree_code_type_tmpl <0>::tree_code_type
[(int) (((enum tree_code) ((args[2]))->base.code))]) <=
tcc_expression)) ? (args[2])->exp.locus : ((location_t) 0
))
);
2719 }
2720 }
2721
2722 add_candidate (candidates, fnname, /*first_arg=*/NULL_TREE(tree) __null, /*args=*/NULL__null,
2723 num_convs, convs,
2724 /*access_path=*/NULL_TREE(tree) __null,
2725 /*conversion_path=*/NULL_TREE(tree) __null,
2726 viable, reason, flags);
2727}
2728
2729static bool
2730is_complete (tree t)
2731{
2732 return COMPLETE_TYPE_P (complete_type (t))(((tree_class_check ((complete_type (t)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2732, __FUNCTION__))->type_common.size) != (tree) __null
)
;
2733}
2734
2735/* Returns nonzero if TYPE is a promoted arithmetic type. */
2736
2737static bool
2738promoted_arithmetic_type_p (tree type)
2739{
2740 /* [over.built]
2741
2742 In this section, the term promoted integral type is used to refer
2743 to those integral types which are preserved by integral promotion
2744 (including e.g. int and long but excluding e.g. char).
2745 Similarly, the term promoted arithmetic type refers to promoted
2746 integral types plus floating types. */
2747 return ((CP_INTEGRAL_TYPE_P (type)(((enum tree_code) (type)->base.code) == BOOLEAN_TYPE || (
(enum tree_code) (type)->base.code) == INTEGER_TYPE)
2748 && same_type_p (type_promotes_to (type), type)comptypes ((type_promotes_to (type)), (type), 0))
2749 || TREE_CODE (type)((enum tree_code) (type)->base.code) == REAL_TYPE);
2750}
2751
2752/* Create any builtin operator overload candidates for the operator in
2753 question given the converted operand types TYPE1 and TYPE2. The other
2754 args are passed through from add_builtin_candidates to
2755 build_builtin_candidate.
2756
2757 TYPE1 and TYPE2 may not be permissible, and we must filter them.
2758 If CODE is requires candidates operands of the same type of the kind
2759 of which TYPE1 and TYPE2 are, we add both candidates
2760 CODE (TYPE1, TYPE1) and CODE (TYPE2, TYPE2). */
2761
2762static void
2763add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
2764 enum tree_code code2, tree fnname, tree type1,
2765 tree type2, vec<tree,va_gc> &args, tree *argtypes,
2766 int flags, tsubst_flags_t complain)
2767{
2768 switch (code)
2769 {
2770 case POSTINCREMENT_EXPR:
2771 case POSTDECREMENT_EXPR:
2772 args[1] = integer_zero_nodeglobal_trees[TI_INTEGER_ZERO];
2773 type2 = integer_type_nodeinteger_types[itk_int];
2774 break;
2775 default:
2776 break;
2777 }
2778
2779 switch (code)
2780 {
2781
2782/* 4 For every pair (T, VQ), where T is an arithmetic type other than bool,
2783 and VQ is either volatile or empty, there exist candidate operator
2784 functions of the form
2785 VQ T& operator++(VQ T&);
2786 T operator++(VQ T&, int);
2787 5 For every pair (T, VQ), where T is an arithmetic type other than bool,
2788 and VQ is either volatile or empty, there exist candidate operator
2789 functions of the form
2790 VQ T& operator--(VQ T&);
2791 T operator--(VQ T&, int);
2792 6 For every pair (T, VQ), where T is a cv-qualified or cv-unqualified object
2793 type, and VQ is either volatile or empty, there exist candidate operator
2794 functions of the form
2795 T*VQ& operator++(T*VQ&);
2796 T*VQ& operator--(T*VQ&);
2797 T* operator++(T*VQ&, int);
2798 T* operator--(T*VQ&, int); */
2799
2800 case POSTDECREMENT_EXPR:
2801 case PREDECREMENT_EXPR:
2802 if (TREE_CODE (type1)((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE)
2803 return;
2804 /* FALLTHRU */
2805 case POSTINCREMENT_EXPR:
2806 case PREINCREMENT_EXPR:
2807 /* P0002R1, Remove deprecated operator++(bool) added "other than bool"
2808 to p4. */
2809 if (TREE_CODE (type1)((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE && cxx_dialect >= cxx17)
2810 return;
2811 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
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2811, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2811, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2811, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
|| ((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2811, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)))
)
2812 {
2813 type1 = build_reference_type (type1);
2814 break;
2815 }
2816 return;
2817
2818/* 7 For every cv-qualified or cv-unqualified object type T, there
2819 exist candidate operator functions of the form
2820
2821 T& operator*(T*);
2822
2823
2824 8 For every function type T that does not have cv-qualifiers or
2825 a ref-qualifier, there exist candidate operator functions of the form
2826 T& operator*(T*); */
2827
2828 case INDIRECT_REF:
2829 if (TYPE_PTR_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE)
2830 && (TYPE_PTROB_P (type1)((((enum tree_code) (type1)->base.code) == POINTER_TYPE) &&
(!(((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2830, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2830, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2830, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
|| ((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2830, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)))
2831 || TREE_CODE (TREE_TYPE (type1))((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2831, __FUNCTION__))->typed.type))->base.code)
== FUNCTION_TYPE))
2832 break;
2833 return;
2834
2835/* 9 For every type T, there exist candidate operator functions of the form
2836 T* operator+(T*);
2837
2838 10 For every floating-point or promoted integral type T, there exist
2839 candidate operator functions of the form
2840 T operator+(T);
2841 T operator-(T); */
2842
2843 case UNARY_PLUS_EXPR: /* unary + */
2844 if (TYPE_PTR_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE))
2845 break;
2846 /* FALLTHRU */
2847 case NEGATE_EXPR:
2848 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)
)
2849 break;
2850 return;
2851
2852/* 11 For every promoted integral type T, there exist candidate operator
2853 functions of the form
2854 T operator~(T); */
2855
2856 case BIT_NOT_EXPR:
2857 if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == ENUMERAL_TYPE &&
!((tree_check ((type1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2857, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
) || (((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (type1)->base.code) == INTEGER_TYPE)
)
)
2858 break;
2859 return;
2860
2861/* 12 For every quintuple (C1, C2, T, CV1, CV2), where C2 is a class type, C1
2862 is the same type as C2 or is a derived class of C2, and T is an object
2863 type or a function type there exist candidate operator functions of the
2864 form
2865 CV12 T& operator->*(CV1 C1*, CV2 T C2::*);
2866 where CV12 is the union of CV1 and CV2. */
2867
2868 case MEMBER_REF:
2869 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2869, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2869, __FUNCTION__))->type_common.lang_flag_2))))
)
2870 {
2871 tree c1 = TREE_TYPE (type1)((contains_struct_check ((type1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2871, __FUNCTION__))->typed.type)
;
2872 tree c2 = TYPE_PTRMEM_CLASS_TYPE (type2)((((enum tree_code) (type2)->base.code) == OFFSET_TYPE) ? (
(tree_check ((type2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2872, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval
) : ((tree_check2 ((((contains_struct_check (((cp_build_qualified_type
(((contains_struct_check ((((tree_check3 ((type2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2872, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2872, __FUNCTION__))->typed.type), cp_type_quals (type2)
))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2872, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2872, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.maxval))
;
2873
2874 if (CLASS_TYPE_P (c1)(((((enum tree_code) (c1)->base.code)) == RECORD_TYPE || (
((enum tree_code) (c1)->base.code)) == UNION_TYPE) &&
((tree_class_check ((c1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2874, __FUNCTION__))->type_common.lang_flag_5))
&& DERIVED_FROM_P (c2, c1)(lookup_base ((c1), (c2), ba_any, __null, tf_none) != (tree) __null
)
2875 && (TYPE_PTRMEMFUNC_P (type2)(((enum tree_code) (type2)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2875, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2875, __FUNCTION__))->type_common.lang_flag_2)))
2876 || is_complete (TYPE_PTRMEM_POINTED_TO_TYPE (type2)((((enum tree_code) (type2)->base.code) == OFFSET_TYPE) ? (
(contains_struct_check ((type2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2876, __FUNCTION__))->typed.type) : ((contains_struct_check
(((cp_build_qualified_type (((contains_struct_check ((((tree_check3
((type2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2876, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2876, __FUNCTION__))->typed.type), cp_type_quals (type2)
))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2876, __FUNCTION__))->typed.type))
)))
2877 break;
2878 }
2879 return;
2880
2881/* 13 For every pair of types L and R, where each of L and R is a floating-point
2882 or promoted integral type, there exist candidate operator functions of the
2883 form
2884 LR operator*(L, R);
2885 LR operator/(L, R);
2886 LR operator+(L, R);
2887 LR operator-(L, R);
2888 bool operator<(L, R);
2889 bool operator>(L, R);
2890 bool operator<=(L, R);
2891 bool operator>=(L, R);
2892 bool operator==(L, R);
2893 bool operator!=(L, R);
2894 where LR is the result of the usual arithmetic conversions between
2895 types L and R.
2896
2897 14 For every integral type T there exists a candidate operator function of
2898 the form
2899
2900 std::strong_ordering operator<=>(T, T);
2901
2902 15 For every pair of floating-point types L and R, there exists a candidate
2903 operator function of the form
2904
2905 std::partial_ordering operator<=>(L, R);
2906
2907 16 For every cv-qualified or cv-unqualified object type T there exist
2908 candidate operator functions of the form
2909 T* operator+(T*, std::ptrdiff_t);
2910 T& operator[](T*, std::ptrdiff_t);
2911 T* operator-(T*, std::ptrdiff_t);
2912 T* operator+(std::ptrdiff_t, T*);
2913 T& operator[](std::ptrdiff_t, T*);
2914
2915 17 For every T, where T is a pointer to object type, there exist candidate
2916 operator functions of the form
2917 std::ptrdiff_t operator-(T, T);
2918
2919 18 For every T, where T is an enumeration type or a pointer type, there
2920 exist candidate operator functions of the form
2921 bool operator<(T, T);
2922 bool operator>(T, T);
2923 bool operator<=(T, T);
2924 bool operator>=(T, T);
2925 bool operator==(T, T);
2926 bool operator!=(T, T);
2927 R operator<=>(T, T);
2928
2929 where R is the result type specified in [expr.spaceship].
2930
2931 19 For every T, where T is a pointer-to-member type or std::nullptr_t,
2932 there exist candidate operator functions of the form
2933 bool operator==(T, T);
2934 bool operator!=(T, T); */
2935
2936 case MINUS_EXPR:
2937 if (TYPE_PTROB_P (type1)((((enum tree_code) (type1)->base.code) == POINTER_TYPE) &&
(!(((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2937, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2937, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2937, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
|| ((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2937, __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
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2937, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type2
), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2937, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type2
), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2937, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
|| ((enum tree_code) (((contains_struct_check ((type2), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2937, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)))
)
2938 break;
2939 if (TYPE_PTROB_P (type1)((((enum tree_code) (type1)->base.code) == POINTER_TYPE) &&
(!(((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2939, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2939, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2939, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
|| ((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2939, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)))
2940 && INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type2)((((enum tree_code) (type2)->base.code) == ENUMERAL_TYPE &&
!((tree_check ((type2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2940, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
) || (((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (type2)->base.code) == INTEGER_TYPE)
)
)
2941 {
2942 type2 = ptrdiff_type_nodeglobal_trees[TI_PTRDIFF_TYPE];
2943 break;
2944 }
2945 /* FALLTHRU */
2946 case MULT_EXPR:
2947 case TRUNC_DIV_EXPR:
2948 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)
)
2949 break;
2950 return;
2951
2952 /* This isn't exactly what's specified above for operator<=>, but it's
2953 close enough. In particular, we don't care about the return type
2954 specified above; it doesn't participate in overload resolution and it
2955 doesn't affect the semantics of the built-in operator. */
2956 case SPACESHIP_EXPR:
2957 case EQ_EXPR:
2958 case NE_EXPR:
2959 if ((TYPE_PTRMEMFUNC_P (type1)(((enum tree_code) (type1)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2959, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2959, __FUNCTION__))->type_common.lang_flag_2)))
&& TYPE_PTRMEMFUNC_P (type2)(((enum tree_code) (type2)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2959, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2959, __FUNCTION__))->type_common.lang_flag_2)))
)
2960 || (TYPE_PTRDATAMEM_P (type1)(((enum tree_code) (type1)->base.code) == OFFSET_TYPE) && TYPE_PTRDATAMEM_P (type2)(((enum tree_code) (type2)->base.code) == OFFSET_TYPE)))
2961 break;
2962 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))
2963 break;
2964 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2964, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2964, __FUNCTION__))->type_common.lang_flag_2))))
&& null_ptr_cst_p (args[1]))
2965 {
2966 type2 = type1;
2967 break;
2968 }
2969 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2969, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 2969, __FUNCTION__))->type_common.lang_flag_2))))
&& null_ptr_cst_p (args[0]))
2970 {
2971 type1 = type2;
2972 break;
2973 }
2974 /* Fall through. */
2975 case LT_EXPR:
2976 case GT_EXPR:
2977 case LE_EXPR:
2978 case GE_EXPR:
2979 case MAX_EXPR:
2980 case MIN_EXPR:
2981 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)
)
2982 break;
2983 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))
2984 break;
2985 if (TREE_CODE (type1)((enum tree_code) (type1)->base.code) == ENUMERAL_TYPE
2986 && TREE_CODE (type2)((enum tree_code) (type2)->base.code) == ENUMERAL_TYPE)
2987 break;
2988 if (TYPE_PTR_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE)
2989 && null_ptr_cst_p (args[1]))
2990 {
2991 type2 = type1;
2992 break;
2993 }
2994 if (null_ptr_cst_p (args[0])
2995 && TYPE_PTR_P (type2)(((enum tree_code) (type2)->base.code) == POINTER_TYPE))
2996 {
2997 type1 = type2;
2998 break;
2999 }
3000 return;
3001
3002 case PLUS_EXPR:
3003 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)
)
3004 break;
3005 /* FALLTHRU */
3006 case ARRAY_REF:
3007 if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == ENUMERAL_TYPE &&
!((tree_check ((type1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3007, __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
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3007, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type2
), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3007, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type2
), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3007, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
|| ((enum tree_code) (((contains_struct_check ((type2), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3007, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)))
)
3008 {
3009 type1 = ptrdiff_type_nodeglobal_trees[TI_PTRDIFF_TYPE];
3010 break;
3011 }
3012 if (TYPE_PTROB_P (type1)((((enum tree_code) (type1)->base.code) == POINTER_TYPE) &&
(!(((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3012, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3012, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3012, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
|| ((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3012, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3012, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
) || (((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (type2)->base.code) == INTEGER_TYPE)
)
)
3013 {
3014 type2 = ptrdiff_type_nodeglobal_trees[TI_PTRDIFF_TYPE];
3015 break;
3016 }
3017 return;
3018
3019/* 18For every pair of promoted integral types L and R, there exist candi-
3020 date operator functions of the form
3021 LR operator%(L, R);
3022 LR operator&(L, R);
3023 LR operator^(L, R);
3024 LR operator|(L, R);
3025 L operator<<(L, R);
3026 L operator>>(L, R);
3027 where LR is the result of the usual arithmetic conversions between
3028 types L and R. */
3029
3030 case TRUNC_MOD_EXPR:
3031 case BIT_AND_EXPR:
3032 case BIT_IOR_EXPR:
3033 case BIT_XOR_EXPR:
3034 case LSHIFT_EXPR:
3035 case RSHIFT_EXPR:
3036 if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == ENUMERAL_TYPE &&
!((tree_check ((type1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3036, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3036, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
) || (((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (type2)->base.code) == INTEGER_TYPE)
)
)
3037 break;
3038 return;
3039
3040/* 19For every triple L, VQ, R), where L is an arithmetic or enumeration
3041 type, VQ is either volatile or empty, and R is a promoted arithmetic
3042 type, there exist candidate operator functions of the form
3043 VQ L& operator=(VQ L&, R);
3044 VQ L& operator*=(VQ L&, R);
3045 VQ L& operator/=(VQ L&, R);
3046 VQ L& operator+=(VQ L&, R);
3047 VQ L& operator-=(VQ L&, R);
3048
3049 20For every pair T, VQ), where T is any type and VQ is either volatile
3050 or empty, there exist candidate operator functions of the form
3051 T*VQ& operator=(T*VQ&, T*);
3052
3053 21For every pair T, VQ), where T is a pointer to member type and VQ is
3054 either volatile or empty, there exist candidate operator functions of
3055 the form
3056 VQ T& operator=(VQ T&, T);
3057
3058 22For every triple T, VQ, I), where T is a cv-qualified or cv-
3059 unqualified complete object type, VQ is either volatile or empty, and
3060 I is a promoted integral type, there exist candidate operator func-
3061 tions of the form
3062 T*VQ& operator+=(T*VQ&, I);
3063 T*VQ& operator-=(T*VQ&, I);
3064
3065 23For every triple L, VQ, R), where L is an integral or enumeration
3066 type, VQ is either volatile or empty, and R is a promoted integral
3067 type, there exist candidate operator functions of the form
3068
3069 VQ L& operator%=(VQ L&, R);
3070 VQ L& operator<<=(VQ L&, R);
3071 VQ L& operator>>=(VQ L&, R);
3072 VQ L& operator&=(VQ L&, R);
3073 VQ L& operator^=(VQ L&, R);
3074 VQ L& operator|=(VQ L&, R); */
3075
3076 case MODIFY_EXPR:
3077 switch (code2)
3078 {
3079 case PLUS_EXPR:
3080 case MINUS_EXPR:
3081 if (TYPE_PTROB_P (type1)((((enum tree_code) (type1)->base.code) == POINTER_TYPE) &&
(!(((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3081, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3081, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3081, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
|| ((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3081, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3081, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
) || (((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (type2)->base.code) == INTEGER_TYPE)
)
)
3082 {
3083 type2 = ptrdiff_type_nodeglobal_trees[TI_PTRDIFF_TYPE];
3084 break;
3085 }
3086 /* FALLTHRU */
3087 case MULT_EXPR:
3088 case TRUNC_DIV_EXPR:
3089 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)
)
3090 break;
3091 return;
3092
3093 case TRUNC_MOD_EXPR:
3094 case BIT_AND_EXPR:
3095 case BIT_IOR_EXPR:
3096 case BIT_XOR_EXPR:
3097 case LSHIFT_EXPR:
3098 case RSHIFT_EXPR:
3099 if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == ENUMERAL_TYPE &&
!((tree_check ((type1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3099, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3099, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
) || (((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (type2)->base.code) == INTEGER_TYPE)
)
)
3100 break;
3101 return;
3102
3103 case NOP_EXPR:
3104 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)
)
3105 break;
3106 if ((TYPE_PTRMEMFUNC_P (type1)(((enum tree_code) (type1)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3106, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3106, __FUNCTION__))->type_common.lang_flag_2)))
&& TYPE_PTRMEMFUNC_P (type2)(((enum tree_code) (type2)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3106, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3106, __FUNCTION__))->type_common.lang_flag_2)))
)
3107 || (TYPE_PTR_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE) && TYPE_PTR_P (type2)(((enum tree_code) (type2)->base.code) == POINTER_TYPE))
3108 || (TYPE_PTRDATAMEM_P (type1)(((enum tree_code) (type1)->base.code) == OFFSET_TYPE) && TYPE_PTRDATAMEM_P (type2)(((enum tree_code) (type2)->base.code) == OFFSET_TYPE))
3109 || ((TYPE_PTRMEMFUNC_P (type1)(((enum tree_code) (type1)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3109, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3109, __FUNCTION__))->type_common.lang_flag_2)))
3110 || TYPE_PTR_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE))
3111 && null_ptr_cst_p (args[1])))
3112 {
3113 type2 = type1;
3114 break;
3115 }
3116 return;
3117
3118 default:
3119 gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3119, __FUNCTION__))
;
3120 }
3121 type1 = build_reference_type (type1);
3122 break;
3123
3124 case COND_EXPR:
3125 /* [over.built]
3126
3127 For every pair of promoted arithmetic types L and R, there
3128 exist candidate operator functions of the form
3129
3130 LR operator?(bool, L, R);
3131
3132 where LR is the result of the usual arithmetic conversions
3133 between types L and R.
3134
3135 For every type T, where T is a pointer or pointer-to-member
3136 type, there exist candidate operator functions of the form T
3137 operator?(bool, T, T); */
3138
3139 if (promoted_arithmetic_type_p (type1)
3140 && promoted_arithmetic_type_p (type2))
3141 /* That's OK. */
3142 break;
3143
3144 /* Otherwise, the types should be pointers. */
3145 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3145, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3145, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3145, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3145, __FUNCTION__))->type_common.lang_flag_2)))))
)
3146 return;
3147
3148 /* We don't check that the two types are the same; the logic
3149 below will actually create two candidates; one in which both
3150 parameter types are TYPE1, and one in which both parameter
3151 types are TYPE2. */
3152 break;
3153
3154 case REALPART_EXPR:
3155 case IMAGPART_EXPR:
3156 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)
)
3157 break;
3158 return;
3159
3160 default:
3161 gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3161, __FUNCTION__))
;
3162 }
3163
3164 /* Make sure we don't create builtin candidates with dependent types. */
3165 bool u1 = uses_template_parms (type1);
3166 bool u2 = type2 ? uses_template_parms (type2) : false;
3167 if (u1 || u2)
3168 {
3169 /* Try to recover if one of the types is non-dependent. But if
3170 there's only one type, there's nothing we can do. */
3171 if (!type2)
3172 return;
3173 /* And we lose if both are dependent. */
3174 if (u1 && u2)
3175 return;
3176 /* Or if they have different forms. */
3177 if (TREE_CODE (type1)((enum tree_code) (type1)->base.code) != TREE_CODE (type2)((enum tree_code) (type2)->base.code))
3178 return;
3179
3180 if (u1 && !u2)
3181 type1 = type2;
3182 else if (u2 && !u1)
3183 type2 = type1;
3184 }
3185
3186 /* If we're dealing with two pointer types or two enumeral types,
3187 we need candidates for both of them. */
3188 if (type2 && !same_type_p (type1, type2)comptypes ((type1), (type2), 0)
3189 && TREE_CODE (type1)((enum tree_code) (type1)->base.code) == TREE_CODE (type2)((enum tree_code) (type2)->base.code)
3190 && (TYPE_REF_P (type1)(((enum tree_code) (type1)->base.code) == REFERENCE_TYPE)
3191 || (TYPE_PTR_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE) && TYPE_PTR_P (type2)(((enum tree_code) (type2)->base.code) == POINTER_TYPE))
3192 || (TYPE_PTRDATAMEM_P (type1)(((enum tree_code) (type1)->base.code) == OFFSET_TYPE) && TYPE_PTRDATAMEM_P (type2)(((enum tree_code) (type2)->base.code) == OFFSET_TYPE))
3193 || TYPE_PTRMEMFUNC_P (type1)(((enum tree_code) (type1)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3193, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3193, __FUNCTION__))->type_common.lang_flag_2)))
3194 || 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) == TRAIT_TYPE ||
((enum tree_code) (type1)->base.code) == DEPENDENT_OPERATOR_TYPE
) || (((((enum tree_code) (type1)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (type1)->base.code)) == UNION_TYPE)
&& ((tree_class_check ((type1), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3194, __FUNCTION__))->type_common.lang_flag_5)))
3195 || TREE_CODE (type1)((enum tree_code) (type1)->base.code) == ENUMERAL_TYPE))
3196 {
3197 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3197, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3197, __FUNCTION__))->type_common.lang_flag_2)))))
)
3198 {
3199 tree cptype = composite_pointer_type (input_location,
3200 type1, type2,
3201 error_mark_nodeglobal_trees[TI_ERROR_MARK],
3202 error_mark_nodeglobal_trees[TI_ERROR_MARK],
3203 CPO_CONVERSION,
3204 tf_none);
3205 if (cptype != error_mark_nodeglobal_trees[TI_ERROR_MARK])
3206 {
3207 build_builtin_candidate
3208 (candidates, fnname, cptype, cptype, args, argtypes,
3209 flags, complain);
3210 return;
3211 }
3212 }
3213
3214 build_builtin_candidate
3215 (candidates, fnname, type1, type1, args, argtypes, flags, complain);
3216 build_builtin_candidate
3217 (candidates, fnname, type2, type2, args, argtypes, flags, complain);
3218 return;
3219 }
3220
3221 build_builtin_candidate
3222 (candidates, fnname, type1, type2, args, argtypes, flags, complain);
3223}
3224
3225tree
3226type_decays_to (tree type)
3227{
3228 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == ARRAY_TYPE)
3229 return build_pointer_type (TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3229, __FUNCTION__))->typed.type)
);
3230 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == FUNCTION_TYPE)
3231 return build_pointer_type (type);
3232 return type;
3233}
3234
3235/* There are three conditions of builtin candidates:
3236
3237 1) bool-taking candidates. These are the same regardless of the input.
3238 2) pointer-pair taking candidates. These are generated for each type
3239 one of the input types converts to.
3240 3) arithmetic candidates. According to the standard, we should generate
3241 all of these, but I'm trying not to...
3242
3243 Here we generate a superset of the possible candidates for this particular
3244 case. That is a subset of the full set the standard defines, plus some
3245 other cases which the standard disallows. add_builtin_candidate will
3246 filter out the invalid set. */
3247
3248static void
3249add_builtin_candidates (struct z_candidate **candidates, enum tree_code code,
3250 enum tree_code code2, tree fnname,
3251 vec<tree, va_gc> *argv,
3252 int flags, tsubst_flags_t complain)
3253{
3254 int ref1;
3255 int enum_p = 0;
3256 tree type, argtypes[3], t;
3257 /* TYPES[i] is the set of possible builtin-operator parameter types
3258 we will consider for the Ith argument. */
3259 vec<tree, va_gc> *types[2];
3260 unsigned ix;
3261 vec<tree, va_gc> &args = *argv;
3262 unsigned len = args.length ();
3263
3264 for (unsigned i = 0; i < len; ++i)
3265 {
3266 if (args[i])
3267 argtypes[i] = unlowered_expr_type (args[i]);
3268 else
3269 argtypes[i] = NULL_TREE(tree) __null;
3270 }
3271
3272 switch (code)
3273 {
3274/* 4 For every pair T, VQ), where T is an arithmetic or enumeration type,
3275 and VQ is either volatile or empty, there exist candidate operator
3276 functions of the form
3277 VQ T& operator++(VQ T&); */
3278
3279 case POSTINCREMENT_EXPR:
3280 case PREINCREMENT_EXPR:
3281 case POSTDECREMENT_EXPR:
3282 case PREDECREMENT_EXPR:
3283 case MODIFY_EXPR:
3284 ref1 = 1;
3285 break;
3286
3287/* 24There also exist candidate operator functions of the form
3288 bool operator!(bool);
3289 bool operator&&(bool, bool);
3290 bool operator||(bool, bool); */
3291
3292 case TRUTH_NOT_EXPR:
3293 build_builtin_candidate
3294 (candidates, fnname, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE],
3295 NULL_TREE(tree) __null, args, argtypes, flags, complain);
3296 return;
3297
3298 case TRUTH_ORIF_EXPR:
3299 case TRUTH_ANDIF_EXPR:
3300 build_builtin_candidate
3301 (candidates, fnname, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE],
3302 boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], args, argtypes, flags, complain);
3303 return;
3304
3305 case ADDR_EXPR:
3306 case COMPOUND_EXPR:
3307 case COMPONENT_REF:
3308 case CO_AWAIT_EXPR:
3309 return;
3310
3311 case COND_EXPR:
3312 case EQ_EXPR:
3313 case NE_EXPR:
3314 case LT_EXPR:
3315 case LE_EXPR:
3316 case GT_EXPR:
3317 case GE_EXPR:
3318 case SPACESHIP_EXPR:
3319 enum_p = 1;
3320 /* Fall through. */
3321
3322 default:
3323 ref1 = 0;
3324 }
3325
3326 types[0] = make_tree_vector ();
3327 types[1] = make_tree_vector ();
3328
3329 if (len == 3)
3330 len = 2;
3331 for (unsigned i = 0; i < len; ++i)
3332 {
3333 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) == TRAIT_TYPE
|| ((enum tree_code) (argtypes[i])->base.code) == DEPENDENT_OPERATOR_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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3333, __FUNCTION__))->type_common.lang_flag_5)))
)
3334 {
3335 tree convs;
3336
3337 if (i == 0 && code == MODIFY_EXPR && code2 == NOP_EXPR)
3338 return;
3339
3340 convs = lookup_conversions (argtypes[i]);
3341
3342 if (code == COND_EXPR)
3343 {
3344 if (lvalue_p (args[i]))
3345 vec_safe_push (types[i], build_reference_type (argtypes[i]));
3346
3347 vec_safe_push (types[i], TYPE_MAIN_VARIANT (argtypes[i])((tree_class_check ((argtypes[i]), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3347, __FUNCTION__))->type_common.main_variant)
);
3348 }
3349
3350 else if (! convs)
3351 return;
3352
3353 for (; convs; convs = TREE_CHAIN (convs)((contains_struct_check ((convs), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3353, __FUNCTION__))->common.chain)
)
3354 {
3355 type = TREE_TYPE (convs)((contains_struct_check ((convs), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3355, __FUNCTION__))->typed.type)
;
3356
3357 if (i == 0 && ref1
3358 && (!TYPE_REF_P (type)(((enum tree_code) (type)->base.code) == REFERENCE_TYPE)
3359 || CP_TYPE_CONST_P (TREE_TYPE (type))((cp_type_quals (((contains_struct_check ((type), (TS_TYPED),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3359, __FUNCTION__))->typed.type)) & TYPE_QUAL_CONST
) != 0)
))
3360 continue;
3361
3362 if (code == COND_EXPR && TYPE_REF_P (type)(((enum tree_code) (type)->base.code) == REFERENCE_TYPE))
3363 vec_safe_push (types[i], type);
3364
3365 type = non_reference (type);
3366 if (i != 0 || ! ref1)
3367 {
3368 type = cv_unqualified (type_decays_to (type));
3369 if (enum_p && TREE_CODE (type)((enum tree_code) (type)->base.code) == ENUMERAL_TYPE)
3370 vec_safe_push (types[i], type);
3371 if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type)((((enum tree_code) (type)->base.code) == ENUMERAL_TYPE &&
!((tree_check ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3371, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
) || (((enum tree_code) (type)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (type)->base.code) == INTEGER_TYPE))
)
3372 type = type_promotes_to (type);
3373 }
3374
3375 if (! vec_member (type, types[i]))
3376 vec_safe_push (types[i], type);
3377 }
3378 }
3379 else
3380 {
3381 if (code == COND_EXPR && lvalue_p (args[i]))
3382 vec_safe_push (types[i], build_reference_type (argtypes[i]));
3383 type = non_reference (argtypes[i]);
3384 if (i != 0 || ! ref1)
3385 {
3386 type = cv_unqualified (type_decays_to (type));
3387 if (enum_p && UNSCOPED_ENUM_P (type)(((enum tree_code) (type)->base.code) == ENUMERAL_TYPE &&
!((tree_check ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3387, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
)
)
3388 vec_safe_push (types[i], type);
3389 if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type)((((enum tree_code) (type)->base.code) == ENUMERAL_TYPE &&
!((tree_check ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3389, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
) || (((enum tree_code) (type)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (type)->base.code) == INTEGER_TYPE))
)
3390 type = type_promotes_to (type);
3391 }
3392 vec_safe_push (types[i], type);
3393 }
3394 }
3395
3396 /* Run through the possible parameter types of both arguments,
3397 creating candidates with those parameter types. */
3398 FOR_EACH_VEC_ELT_REVERSE (*(types[0]), ix, t)for (ix = (*(types[0])).length () - 1; (*(types[0])).iterate (
(ix), &(t)); (ix)--)
3399 {
3400 unsigned jx;
3401 tree u;
3402
3403 if (!types[1]->is_empty ())
3404 FOR_EACH_VEC_ELT_REVERSE (*(types[1]), jx, u)for (jx = (*(types[1])).length () - 1; (*(types[1])).iterate (
(jx), &(u)); (jx)--)
3405 add_builtin_candidate
3406 (candidates, code, code2, fnname, t,
3407 u, args, argtypes, flags, complain);
3408 else
3409 add_builtin_candidate
3410 (candidates, code, code2, fnname, t,
3411 NULL_TREE(tree) __null, args, argtypes, flags, complain);
3412 }
3413
3414 release_tree_vector (types[0]);
3415 release_tree_vector (types[1]);
3416}
3417
3418
3419/* If TMPL can be successfully instantiated as indicated by
3420 EXPLICIT_TARGS and ARGLIST, adds the instantiation to CANDIDATES.
3421
3422 TMPL is the template. EXPLICIT_TARGS are any explicit template
3423 arguments. ARGLIST is the arguments provided at the call-site.
3424 This does not change ARGLIST. The RETURN_TYPE is the desired type
3425 for conversion operators. If OBJ is NULL_TREE, FLAGS and CTYPE are
3426 as for add_function_candidate. If an OBJ is supplied, FLAGS and
3427 CTYPE are ignored, and OBJ is as for add_conv_candidate.
3428
3429 SHORTCUT_BAD_CONVS is as in add_function_candidate. */
3430
3431static struct z_candidate*
3432add_template_candidate_real (struct z_candidate **candidates, tree tmpl,
3433 tree ctype, tree explicit_targs, tree first_arg,
3434 const vec<tree, va_gc> *arglist, tree return_type,
3435 tree access_path, tree conversion_path,
3436 int flags, tree obj, unification_kind_t strict,
3437 bool shortcut_bad_convs, tsubst_flags_t complain)
3438{
3439 int ntparms = DECL_NTPARMS (tmpl)((tree_check ((((tree_check ((((struct tree_template_decl *)(
const_cast<union tree_node *> ((((tree_check ((tmpl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3439, __FUNCTION__, (TEMPLATE_DECL))))))))->arguments), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3439, __FUNCTION__, (TREE_LIST)))->list.value)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3439, __FUNCTION__, (TREE_VEC)))->base.u.length)
;
3440 tree targs = make_tree_vec (ntparms);
3441 unsigned int len = vec_safe_length (arglist);
3442 unsigned int nargs = (first_arg == NULL_TREE(tree) __null ? 0 : 1) + len;
3443 unsigned int skip_without_in_chrg = 0;
3444 tree first_arg_without_in_chrg = first_arg;
3445 tree *args_without_in_chrg;
3446 unsigned int nargs_without_in_chrg;
3447 unsigned int ia, ix;
3448 tree arg;
3449 struct z_candidate *cand;
3450 tree fn;
3451 struct rejection_reason *reason = NULL__null;
3452 int errs;
3453 conversion **convs = NULL__null;
3454
3455 /* We don't do deduction on the in-charge parameter, the VTT
3456 parameter or 'this'. */
3457 if (DECL_NONSTATIC_MEMBER_FUNCTION_P (tmpl)(((enum tree_code) (((contains_struct_check ((tmpl), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3457, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)
)
3458 {
3459 if (first_arg_without_in_chrg != NULL_TREE(tree) __null)
3460 first_arg_without_in_chrg = NULL_TREE(tree) __null;
3461 else if (return_type && strict == DEDUCE_CALL)
3462 /* We're deducing for a call to the result of a template conversion
3463 function, so the args don't contain 'this'; leave them alone. */;
3464 else
3465 ++skip_without_in_chrg;
3466 }
3467
3468 if ((DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (tmpl)(((contains_struct_check ((tmpl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3468, __FUNCTION__))->decl_minimal.name) == cp_global_trees
[CPTI_CTOR_IDENTIFIER])
3469 || DECL_BASE_CONSTRUCTOR_P (tmpl)(((contains_struct_check ((tmpl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3469, __FUNCTION__))->decl_minimal.name) == cp_global_trees
[CPTI_BASE_CTOR_IDENTIFIER])
)
3470 && CLASSTYPE_VBASECLASSES (DECL_CONTEXT (tmpl))((((tree_class_check ((((contains_struct_check ((tmpl), (TS_DECL_MINIMAL
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3470, __FUNCTION__))->decl_minimal.context)), (tcc_type)
, "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3470, __FUNCTION__))->type_with_lang_specific.lang_specific
))->vbases)
)
3471 {
3472 if (first_arg_without_in_chrg != NULL_TREE(tree) __null)
3473 first_arg_without_in_chrg = NULL_TREE(tree) __null;
3474 else
3475 ++skip_without_in_chrg;
3476 }
3477
3478 if (len < skip_without_in_chrg)
3479 return NULL__null;
3480
3481 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3481, __FUNCTION__, (TEMPLATE_DECL))))))))->result : tmpl
)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3481, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
&& nargs == 2
3482 && same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (first_arg)((contains_struct_check ((first_arg), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3482, __FUNCTION__))->typed.type)
,
3483 TREE_TYPE ((*arglist)[0])((contains_struct_check (((*arglist)[0]), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3483, __FUNCTION__))->typed.type)
))
3484 {
3485 /* 12.8/6 says, "A declaration of a constructor for a class X is
3486 ill-formed if its first parameter is of type (optionally cv-qualified)
3487 X and either there are no other parameters or else all other
3488 parameters have default arguments. A member function template is never
3489 instantiated to produce such a constructor signature."
3490
3491 So if we're trying to copy an object of the containing class, don't
3492 consider a template constructor that has a first parameter type that
3493 is just a template parameter, as we would deduce a signature that we
3494 would then reject in the code below. */
3495 if (tree firstparm = FUNCTION_FIRST_USER_PARMTYPE (tmpl)skip_artificial_parms_for ((tmpl), ((tree_check2 ((((contains_struct_check
((tmpl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3495, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3495, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values))
)
3496 {
3497 firstparm = TREE_VALUE (firstparm)((tree_check ((firstparm), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3497, __FUNCTION__, (TREE_LIST)))->list.value)
;
3498 if (PACK_EXPANSION_P (firstparm)(((enum tree_code) (firstparm)->base.code) == TYPE_PACK_EXPANSION
|| ((enum tree_code) (firstparm)->base.code) == EXPR_PACK_EXPANSION
)
)
3499 firstparm = PACK_EXPANSION_PATTERN (firstparm)(((enum tree_code) ((tree_check2 ((firstparm), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3499, __FUNCTION__, (TYPE_PACK_EXPANSION), (EXPR_PACK_EXPANSION
))))->base.code) == TYPE_PACK_EXPANSION ? ((contains_struct_check
((firstparm), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3499, __FUNCTION__))->typed.type) : (*((const_cast<tree
*> (tree_operand_check ((firstparm), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3499, __FUNCTION__))))))
;
3500 if (TREE_CODE (firstparm)((enum tree_code) (firstparm)->base.code) == TEMPLATE_TYPE_PARM)
3501 {
3502 gcc_assert (!explicit_targs)((void)(!(!explicit_targs) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3502, __FUNCTION__), 0 : 0))
;
3503 reason = invalid_copy_with_fn_template_rejection ();
3504 goto fail;
3505 }
3506 }
3507 }
3508
3509 nargs_without_in_chrg = ((first_arg_without_in_chrg != NULL_TREE(tree) __null ? 1 : 0)
3510 + (len - skip_without_in_chrg));
3511 args_without_in_chrg = XALLOCAVEC (tree, nargs_without_in_chrg)((tree *) __builtin_alloca(sizeof (tree) * (nargs_without_in_chrg
)))
;
3512 ia = 0;
3513 if (first_arg_without_in_chrg != NULL_TREE(tree) __null)
3514 {
3515 args_without_in_chrg[ia] = first_arg_without_in_chrg;
3516 ++ia;
3517 }
3518 for (ix = skip_without_in_chrg;
3519 vec_safe_iterate (arglist, ix, &arg);
3520 ++ix)
3521 {
3522 args_without_in_chrg[ia] = arg;
3523 ++ia;
3524 }
3525 gcc_assert (ia == nargs_without_in_chrg)((void)(!(ia == nargs_without_in_chrg) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3525, __FUNCTION__), 0 : 0))
;
3526
3527 if (!obj && explicit_targs)
3528 {
3529 /* Check that there's no obvious arity mismatch before proceeding with
3530 deduction. This avoids substituting explicit template arguments
3531 into the template (which could result in an error outside the
3532 immediate context) when the resulting candidate would be unviable
3533 anyway. */
3534 int min_arity = 0, max_arity = 0;
3535 tree parms = TYPE_ARG_TYPES (TREE_TYPE (tmpl))((tree_check2 ((((contains_struct_check ((tmpl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3535, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3535, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)
;
3536 parms = skip_artificial_parms_for (tmpl, parms);
3537 for (; parms != void_list_nodeglobal_trees[TI_VOID_LIST_NODE]; parms = TREE_CHAIN (parms)((contains_struct_check ((parms), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3537, __FUNCTION__))->common.chain)
)
3538 {
3539 if (!parms || PACK_EXPANSION_P (TREE_VALUE (parms))(((enum tree_code) (((tree_check ((parms), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3539, __FUNCTION__, (TREE_LIST)))->list.value))->base
.code) == TYPE_PACK_EXPANSION || ((enum tree_code) (((tree_check
((parms), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3539, __FUNCTION__, (TREE_LIST)))->list.value))->base
.code) == EXPR_PACK_EXPANSION)
)
3540 {
3541 max_arity = -1;
3542 break;
3543 }
3544 if (TREE_PURPOSE (parms)((tree_check ((parms), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3544, __FUNCTION__, (TREE_LIST)))->list.purpose)
)
3545 /* A parameter with a default argument. */
3546 ++max_arity;
3547 else
3548 ++min_arity, ++max_arity;
3549 }
3550 if (ia < (unsigned)min_arity)
3551 {
3552 /* Too few arguments. */
3553 reason = arity_rejection (NULL_TREE(tree) __null, min_arity, ia,
3554 /*least_p=*/(max_arity == -1));
3555 goto fail;
3556 }
3557 else if (max_arity != -1 && ia > (unsigned)max_arity)
3558 {
3559 /* Too many arguments. */
3560 reason = arity_rejection (NULL_TREE(tree) __null, max_arity, ia);
3561 goto fail;
3562 }
3563 }
3564
3565 errs = errorcount(global_dc)->diagnostic_count[(int) (DK_ERROR)]+sorrycount(global_dc)->diagnostic_count[(int) (DK_SORRY)];
3566 if (!obj)
3567 {
3568 convs = alloc_conversions (nargs);
3569
3570 if (shortcut_bad_convs
3571 && DECL_NONSTATIC_MEMBER_FUNCTION_P (tmpl)(((enum tree_code) (((contains_struct_check ((tmpl), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3571, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)
3572 && !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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3572, __FUNCTION__, (TEMPLATE_DECL))))))))->result : tmpl
)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3572, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
)
3573 {
3574 /* Check the 'this' conversion before proceeding with deduction.
3575 This is effectively an extension of the DR 1391 resolution
3576 that we perform in check_non_deducible_conversions, though it's
3577 convenient to do this extra check here instead of there. */
3578 tree parmtype = TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (tmpl)))((tree_check ((((tree_check2 ((((contains_struct_check ((tmpl
), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3578, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3578, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3578, __FUNCTION__, (TREE_LIST)))->list.value)
;
3579 tree argtype = lvalue_type (first_arg);
3580 tree arg = first_arg;
3581 conversion *t = build_this_conversion (tmpl, ctype,
3582 parmtype, argtype, arg,
3583 flags, complain);
3584 convs[0] = t;
3585 if (t->bad_p)
3586 {
3587 reason = bad_arg_conversion_rejection (first_arg, 0,
3588 arg, parmtype,
3589 EXPR_LOCATION (arg)((((arg)) && ((tree_code_type_tmpl <0>::tree_code_type
[(int) (((enum tree_code) ((arg))->base.code))]) >= tcc_reference
&& (tree_code_type_tmpl <0>::tree_code_type[(int
) (((enum tree_code) ((arg))->base.code))]) <= tcc_expression
)) ? (arg)->exp.locus : ((location_t) 0))
);
3590 goto fail;
3591 }
3592 }
3593 }
3594 fn = fn_type_unification (tmpl, explicit_targs, targs,
3595 args_without_in_chrg,
3596 nargs_without_in_chrg,
3597 return_type, strict, flags, convs,
3598 false, complain & tf_decltype);
3599
3600 if (fn == error_mark_nodeglobal_trees[TI_ERROR_MARK])
3601 {
3602 /* Don't repeat unification later if it already resulted in errors. */
3603 if (errorcount(global_dc)->diagnostic_count[(int) (DK_ERROR)]+sorrycount(global_dc)->diagnostic_count[(int) (DK_SORRY)] == errs)
3604 reason = template_unification_rejection (tmpl, explicit_targs,
3605 targs, args_without_in_chrg,
3606 nargs_without_in_chrg,
3607 return_type, strict, flags);
3608 else
3609 reason = template_unification_error_rejection ();
3610 goto fail;
3611 }
3612
3613 /* Now the explicit specifier might have been deduced; check if this
3614 declaration is explicit. If it is and we're ignoring non-converting
3615 constructors, don't add this function to the set of candidates. */
3616 if (((flags & (LOOKUP_ONLYCONVERTING(1 << 2)|LOOKUP_LIST_INIT_CTOR(((1 << 6) << 1) << 1)))
3617 == LOOKUP_ONLYCONVERTING(1 << 2))
3618 && 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3618, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3618, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3618, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3618, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3618, __FUNCTION__); &lt->u.fn; })->nonconverting
)
)
3619 return NULL__null;
3620
3621 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3621, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3621, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
&& nargs == 2)
3622 {
3623 tree arg_types = FUNCTION_FIRST_USER_PARMTYPE (fn)skip_artificial_parms_for ((fn), ((tree_check2 ((((contains_struct_check
((fn), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3623, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3623, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values))
;
3624 if (arg_types && same_type_p (TYPE_MAIN_VARIANT (TREE_VALUE (arg_types)),comptypes ((((tree_class_check ((((tree_check ((arg_types), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3624, __FUNCTION__, (TREE_LIST)))->list.value)), (tcc_type
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3624, __FUNCTION__))->type_common.main_variant)), (ctype
), 0)
3625 ctype)comptypes ((((tree_class_check ((((tree_check ((arg_types), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3624, __FUNCTION__, (TREE_LIST)))->list.value)), (tcc_type
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3624, __FUNCTION__))->type_common.main_variant)), (ctype
), 0)
)
3626 {
3627 /* We're trying to produce a constructor with a prohibited signature,
3628 as discussed above; handle here any cases we didn't catch then,
3629 such as X(X<T>). */
3630 reason = invalid_copy_with_fn_template_rejection ();
3631 goto fail;
3632 }
3633 }
3634
3635 if (obj != NULL_TREE(tree) __null)
3636 /* Aha, this is a conversion function. */
3637 cand = add_conv_candidate (candidates, fn, obj, arglist,
3638 access_path, conversion_path, complain);
3639 else
3640 cand = add_function_candidate (candidates, fn, ctype,
3641 first_arg, arglist, access_path,
3642 conversion_path, flags, convs,
3643 shortcut_bad_convs, complain);
3644 if (DECL_TI_TEMPLATE (fn)((struct tree_template_info*)(tree_check (((((contains_struct_check
((template_info_decl_check ((fn), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3644, __FUNCTION__)), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3644, __FUNCTION__))->decl_common.lang_specific) ->u.
min.template_info)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3644, __FUNCTION__, (TEMPLATE_INFO))))->tmpl
!= tmpl)
3645 /* This situation can occur if a member template of a template
3646 class is specialized. Then, instantiate_template might return
3647 an instantiation of the specialization, in which case the
3648 DECL_TI_TEMPLATE field will point at the original
3649 specialization. For example:
3650
3651 template <class T> struct S { template <class U> void f(U);
3652 template <> void f(int) {}; };
3653 S<double> sd;
3654 sd.f(3);
3655
3656 Here, TMPL will be template <class U> S<double>::f(U).
3657 And, instantiate template will give us the specialization
3658 template <> S<double>::f(int). But, the DECL_TI_TEMPLATE field
3659 for this will point at template <class T> template <> S<T>::f(int),
3660 so that we can find the definition. For the purposes of
3661 overload resolution, however, we want the original TMPL. */
3662 cand->template_decl = build_template_info (tmpl, targs);
3663 else
3664 cand->template_decl = DECL_TEMPLATE_INFO (fn)(((contains_struct_check ((template_info_decl_check ((fn), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3664, __FUNCTION__)), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3664, __FUNCTION__))->decl_common.lang_specific) ->u.
min.template_info)
;
3665 cand->explicit_targs = explicit_targs;
3666
3667 return cand;
3668 fail:
3669 int viable = (reason->code == rr_bad_arg_conversion ? -1 : 0);
3670 return add_candidate (candidates, tmpl, first_arg, arglist, nargs, convs,
3671 access_path, conversion_path, viable, reason, flags);
3672}
3673
3674
3675static struct z_candidate *
3676add_template_candidate (struct z_candidate **candidates, tree tmpl, tree ctype,
3677 tree explicit_targs, tree first_arg,
3678 const vec<tree, va_gc> *arglist, tree return_type,
3679 tree access_path, tree conversion_path, int flags,
3680 unification_kind_t strict, bool shortcut_bad_convs,
3681 tsubst_flags_t complain)
3682{
3683 return
3684 add_template_candidate_real (candidates, tmpl, ctype,
3685 explicit_targs, first_arg, arglist,
3686 return_type, access_path, conversion_path,
3687 flags, NULL_TREE(tree) __null, strict, shortcut_bad_convs,
3688 complain);
3689}
3690
3691/* Create an overload candidate for the conversion function template TMPL,
3692 returning RETURN_TYPE, which will be invoked for expression OBJ to produce a
3693 pointer-to-function which will in turn be called with the argument list
3694 ARGLIST, and add it to CANDIDATES. This does not change ARGLIST. FLAGS is
3695 passed on to implicit_conversion. */
3696
3697static struct z_candidate *
3698add_template_conv_candidate (struct z_candidate **candidates, tree tmpl,
3699 tree obj,
3700 const vec<tree, va_gc> *arglist,
3701 tree return_type, tree access_path,
3702 tree conversion_path, tsubst_flags_t complain)
3703{
3704 /* Making this work broke PR 71117 and 85118, so until the committee resolves
3705 core issue 2189, let's disable this candidate if there are any call
3706 operators. */
3707 if (*candidates)
3708 return NULL__null;
3709
3710 return
3711 add_template_candidate_real (candidates, tmpl, NULL_TREE(tree) __null, NULL_TREE(tree) __null,
3712 NULL_TREE(tree) __null, arglist, return_type, access_path,
3713 conversion_path, 0, obj, DEDUCE_CALL,
3714 /*shortcut_bad_convs=*/false, complain);
3715}
3716
3717/* The CANDS are the set of candidates that were considered for
3718 overload resolution. Return the set of viable candidates, or CANDS
3719 if none are viable. If any of the candidates were viable, set
3720 *ANY_VIABLE_P to true. STRICT_P is true if a candidate should be
3721 considered viable only if it is strictly viable. */
3722
3723static struct z_candidate*
3724splice_viable (struct z_candidate *cands,
3725 bool strict_p,
3726 bool *any_viable_p)
3727{
3728 struct z_candidate *viable;
3729 struct z_candidate **last_viable;
3730 struct z_candidate **cand;
3731 bool found_strictly_viable = false;
3732
3733 /* Be strict inside templates, since build_over_call won't actually
3734 do the conversions to get pedwarns. */
3735 if (processing_template_declscope_chain->x_processing_template_decl)
3736 strict_p = true;
3737
3738 viable = NULL__null;
3739 last_viable = &viable;
3740 *any_viable_p = false;
3741
3742 cand = &cands;
3743 while (*cand)
3744 {
3745 struct z_candidate *c = *cand;
3746 if (!strict_p
3747 && (c->viable == 1 || TREE_CODE (c->fn)((enum tree_code) (c->fn)->base.code) == TEMPLATE_DECL))
3748 {
3749 /* Be strict in the presence of a viable candidate. Also if
3750 there are template candidates, so that we get deduction errors
3751 for them instead of silently preferring a bad conversion. */
3752 strict_p = true;
3753 if (viable && !found_strictly_viable)
3754 {
3755 /* Put any spliced near matches back onto the main list so
3756 that we see them if there is no strict match. */
3757 *any_viable_p = false;
3758 *last_viable = cands;
3759 cands = viable;
3760 viable = NULL__null;
3761 last_viable = &viable;
3762 }
3763 }
3764
3765 if (strict_p ? c->viable == 1 : c->viable)
3766 {
3767 *last_viable = c;
3768 *cand = c->next;
3769 c->next = NULL__null;
3770 last_viable = &c->next;
3771 *any_viable_p = true;
3772 if (c->viable == 1)
3773 found_strictly_viable = true;
3774 }
3775 else
3776 cand = &c->next;
3777 }
3778
3779 return viable ? viable : cands;
3780}
3781
3782static bool
3783any_strictly_viable (struct z_candidate *cands)
3784{
3785 for (; cands; cands = cands->next)
3786 if (cands->viable == 1)
3787 return true;
3788 return false;
3789}
3790
3791/* OBJ is being used in an expression like "OBJ.f (...)". In other
3792 words, it is about to become the "this" pointer for a member
3793 function call. Take the address of the object. */
3794
3795static tree
3796build_this (tree obj)
3797{
3798 /* In a template, we are only concerned about the type of the
3799 expression, so we can take a shortcut. */
3800 if (processing_template_declscope_chain->x_processing_template_decl)
3801 return build_address (obj);
3802
3803 return cp_build_addr_expr (obj, tf_warning_or_error);
3804}
3805
3806/* Returns true iff functions are equivalent. Equivalent functions are
3807 not '==' only if one is a function-local extern function or if
3808 both are extern "C". */
3809
3810static inline int
3811equal_functions (tree fn1, tree fn2)
3812{
3813 if (TREE_CODE (fn1)((enum tree_code) (fn1)->base.code) != TREE_CODE (fn2)((enum tree_code) (fn2)->base.code))
3814 return 0;
3815 if (TREE_CODE (fn1)((enum tree_code) (fn1)->base.code) == TEMPLATE_DECL)
3816 return fn1 == fn2;
3817 if (DECL_LOCAL_DECL_P (fn1)((contains_struct_check (((tree_check2 ((fn1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3817, __FUNCTION__, (VAR_DECL), (FUNCTION_DECL)))), (TS_DECL_COMMON
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3817, __FUNCTION__))->decl_common.lang_flag_0)
|| DECL_LOCAL_DECL_P (fn2)((contains_struct_check (((tree_check2 ((fn2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3817, __FUNCTION__, (VAR_DECL), (FUNCTION_DECL)))), (TS_DECL_COMMON
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3817, __FUNCTION__))->decl_common.lang_flag_0)
3818 || 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3818, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3818, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn1
)), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3818, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3818, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn1)
, "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3818, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3818, __FUNCTION__); &lt->u.fn; })->thunk_p)) &&
((((contains_struct_check ((fn1), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3818, __FUNCTION__))->decl_common.lang_specific) ? ((contains_struct_check
((fn1), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3818, __FUNCTION__))->decl_common.lang_specific)->u.base
.language : (((enum tree_code) (fn1)->base.code) == FUNCTION_DECL
? lang_c : lang_cplusplus)) == lang_c))
)
3819 return decls_match (fn1, fn2);
3820 return fn1 == fn2;
3821}
3822
3823/* Print information about a candidate FN being rejected due to INFO. */
3824
3825static void
3826print_conversion_rejection (location_t loc, struct conversion_info *info,
3827 tree fn)
3828{
3829 tree from = info->from;
3830 if (!TYPE_P (from)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code
) (from)->base.code))] == tcc_type)
)
3831 from = lvalue_type (from);
3832 if (info->n_arg == -1)
3833 {
3834 /* Conversion of implicit `this' argument failed. */
3835 if (!TYPE_P (info->from)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code
) (info->from)->base.code))] == tcc_type)
)
3836 /* A bad conversion for 'this' must be discarding cv-quals. */
3837 inform (loc, " passing %qT as %<this%> "
3838 "argument discards qualifiers",
3839 from);
3840 else
3841 inform (loc, " no known conversion for implicit "
3842 "%<this%> parameter from %qH to %qI",
3843 from, info->to_type);
3844 }
3845 else if (!TYPE_P (info->from)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code
) (info->from)->base.code))] == tcc_type)
)
3846 {
3847 if (info->n_arg >= 0)
3848 inform (loc, " conversion of argument %d would be ill-formed:",
3849 info->n_arg + 1);
3850 perform_implicit_conversion (info->to_type, info->from,
3851 tf_warning_or_error);
3852 }
3853 else if (info->n_arg == -2)
3854 /* Conversion of conversion function return value failed. */
3855 inform (loc, " no known conversion from %qH to %qI",
3856 from, info->to_type);
3857 else
3858 {
3859 if (TREE_CODE (fn)((enum tree_code) (fn)->base.code) == FUNCTION_DECL)
3860 loc = get_fndecl_argument_location (fn, info->n_arg);
3861 inform (loc, " no known conversion for argument %d from %qH to %qI",
3862 info->n_arg + 1, from, info->to_type);
3863 }
3864}
3865
3866/* Print information about a candidate with WANT parameters and we found
3867 HAVE. */
3868
3869static void
3870print_arity_information (location_t loc, unsigned int have, unsigned int want,
3871 bool least_p)
3872{
3873 if (least_p)
3874 inform_n (loc, want,
3875 " candidate expects at least %d argument, %d provided",
3876 " candidate expects at least %d arguments, %d provided",
3877 want, have);
3878 else
3879 inform_n (loc, want,
3880 " candidate expects %d argument, %d provided",
3881 " candidate expects %d arguments, %d provided",
3882 want, have);
3883}
3884
3885/* Print information about one overload candidate CANDIDATE. MSGSTR
3886 is the text to print before the candidate itself.
3887
3888 NOTE: Unlike most diagnostic functions in GCC, MSGSTR is expected
3889 to have been run through gettext by the caller. This wart makes
3890 life simpler in print_z_candidates and for the translators. */
3891
3892static void
3893print_z_candidate (location_t loc, const char *msgstr,
3894 struct z_candidate *candidate)
3895{
3896 const char *msg = (msgstr == NULL__null
3897 ? ""
3898 : ACONCAT ((_(msgstr), " ", NULL))(libiberty_concat_ptr = (char *) __builtin_alloca(concat_length
(gettext (msgstr), " ", __null) + 1), concat_copy2 (gettext (
msgstr), " ", __null))
);
3899 tree fn = candidate->fn;
3900 if (flag_new_inheriting_ctorsglobal_options.x_flag_new_inheriting_ctors)
3901 fn = strip_inheriting_ctors (fn);
3902 location_t cloc = location_of (fn);
3903
3904 if (identifier_p (fn))
3905 {
3906 cloc = loc;
3907 if (candidate->num_convs == 3)
3908 inform (cloc, "%s%<%D(%T, %T, %T)%> (built-in)", msg, fn,
3909 candidate->convs[0]->type,
3910 candidate->convs[1]->type,
3911 candidate->convs[2]->type);
3912 else if (candidate->num_convs == 2)
3913 inform (cloc, "%s%<%D(%T, %T)%> (built-in)", msg, fn,
3914 candidate->convs[0]->type,
3915 candidate->convs[1]->type);
3916 else
3917 inform (cloc, "%s%<%D(%T)%> (built-in)", msg, fn,
3918 candidate->convs[0]->type);
3919 }
3920 else if (TYPE_P (fn)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code
) (fn)->base.code))] == tcc_type)
)
3921 inform (cloc, "%s%qT (conversion)", msg, fn);
3922 else if (candidate->viable == -1)
3923 inform (cloc, "%s%#qD (near match)", msg, fn);
3924 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3924, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3924, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3924, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3924, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 3924, __FUNCTION__); &lt->u.fn; })->min.base.threadprivate_or_deleted_p
)
)
3925 inform (cloc, "%s%#qD (deleted)", msg, fn);
3926 else if (candidate->reversed ())
3927 inform (cloc, "%s%#qD (reversed)", msg, fn);
3928 else if (candidate->rewritten ())
3929 inform (cloc, "%s%#qD (rewritten)", msg, fn);
3930 else
3931 inform (cloc, "%s%#qD", msg, fn);
3932 if (fn != candidate->fn)
3933 {
3934 cloc = location_of (candidate->fn);
3935 inform (cloc, " inherited here");
3936 }
3937 /* Give the user some information about why this candidate failed. */
3938 if (candidate->reason != NULL__null)
3939 {
3940 struct rejection_reason *r = candidate->reason;
3941
3942 switch (r->code)
3943 {
3944 case rr_arity:
3945 print_arity_information (cloc, r->u.arity.actual,
3946 r->u.arity.expected,
3947 r->u.arity.least_p);
3948 break;
3949 case rr_arg_conversion:
3950 print_conversion_rejection (cloc, &r->u.conversion, fn);
3951 break;
3952 case rr_bad_arg_conversion:
3953 print_conversion_rejection (cloc, &r->u.bad_conversion, fn);
3954 break;
3955 case rr_explicit_conversion:
3956 inform (cloc, " return type %qT of explicit conversion function "
3957 "cannot be converted to %qT with a qualification "
3958 "conversion", r->u.conversion.from,
3959 r->u.conversion.to_type);
3960 break;
3961 case rr_template_conversion:
3962 inform (cloc, " conversion from return type %qT of template "
3963 "conversion function specialization to %qT is not an "
3964 "exact match", r->u.conversion.from,
3965 r->u.conversion.to_type);
3966 break;
3967 case rr_template_unification:
3968 /* We use template_unification_error_rejection if unification caused
3969 actual non-SFINAE errors, in which case we don't need to repeat
3970 them here. */
3971 if (r->u.template_unification.tmpl == NULL_TREE(tree) __null)
3972 {
3973 inform (cloc, " substitution of deduced template arguments "
3974 "resulted in errors seen above");
3975 break;
3976 }
3977 /* Re-run template unification with diagnostics. */
3978 inform (cloc, " template argument deduction/substitution failed:");
3979 fn_type_unification (r->u.template_unification.tmpl,
3980 r->u.template_unification.explicit_targs,
3981 (make_tree_vec
3982 (r->u.template_unification.num_targs)),
3983 r->u.template_unification.args,
3984 r->u.template_unification.nargs,
3985 r->u.template_unification.return_type,
3986 r->u.template_unification.strict,
3987 r->u.template_unification.flags,
3988 NULL__null, true, false);
3989 break;
3990 case rr_invalid_copy:
3991 inform (cloc,
3992 " a constructor taking a single argument of its own "
3993 "class type is invalid");
3994 break;
3995 case rr_constraint_failure:
3996 diagnose_constraints (cloc, fn, NULL_TREE(tree) __null);
3997 break;
3998 case rr_inherited_ctor:
3999 inform (cloc, " an inherited constructor is not a candidate for "
4000 "initialization from an expression of the same or derived "
4001 "type");
4002 break;
4003 case rr_none:
4004 default:
4005 /* This candidate didn't have any issues or we failed to
4006 handle a particular code. Either way... */
4007 gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4007, __FUNCTION__))
;
4008 }
4009 }
4010}
4011
4012static void
4013print_z_candidates (location_t loc, struct z_candidate *candidates)
4014{
4015 struct z_candidate *cand1;
4016 struct z_candidate **cand2;
4017
4018 if (!candidates)
4019 return;
4020
4021 /* Remove non-viable deleted candidates. */
4022 cand1 = candidates;
4023 for (cand2 = &cand1; *cand2; )
4024 {
4025 if (TREE_CODE ((*cand2)->fn)((enum tree_code) ((*cand2)->fn)->base.code) == FUNCTION_DECL
4026 && !(*cand2)->viable
4027 && 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4027, __FUNCTION__, (TEMPLATE_DECL))))))))->result : (*cand2
)->fn)), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4027, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4027, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check (((*cand2
)->fn), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4027, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4027, __FUNCTION__); &lt->u.fn; })->min.base.threadprivate_or_deleted_p
)
)
4028 *cand2 = (*cand2)->next;
4029 else
4030 cand2 = &(*cand2)->next;
4031 }
4032 /* ...if there are any non-deleted ones. */
4033 if (cand1)
4034 candidates = cand1;
4035
4036 /* There may be duplicates in the set of candidates. We put off
4037 checking this condition as long as possible, since we have no way
4038 to eliminate duplicates from a set of functions in less than n^2
4039 time. Now we are about to emit an error message, so it is more
4040 permissible to go slowly. */
4041 for (cand1 = candidates; cand1; cand1 = cand1->next)
4042 {
4043 tree fn = cand1->fn;
4044 /* Skip builtin candidates and conversion functions. */
4045 if (!DECL_P (fn)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code
) (fn)->base.code))] == tcc_declaration)
)
4046 continue;
4047 cand2 = &cand1->next;
4048 while (*cand2)
4049 {
4050 if (DECL_P ((*cand2)->fn)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code
) ((*cand2)->fn)->base.code))] == tcc_declaration)
4051 && equal_functions (fn, (*cand2)->fn))
4052 *cand2 = (*cand2)->next;
4053 else
4054 cand2 = &(*cand2)->next;
4055 }
4056 }
4057
4058 for (; candidates; candidates = candidates->next)
4059 print_z_candidate (loc, N_("candidate:")"candidate:", candidates);
4060}
4061
4062/* USER_SEQ is a user-defined conversion sequence, beginning with a
4063 USER_CONV. STD_SEQ is the standard conversion sequence applied to
4064 the result of the conversion function to convert it to the final
4065 desired type. Merge the two sequences into a single sequence,
4066 and return the merged sequence. */
4067
4068static conversion *
4069merge_conversion_sequences (conversion *user_seq, conversion *std_seq)
4070{
4071 conversion **t;
4072 bool bad = user_seq->bad_p;
4073
4074 gcc_assert (user_seq->kind == ck_user)((void)(!(user_seq->kind == ck_user) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4074, __FUNCTION__), 0 : 0))
;
4075
4076 /* Find the end of the second conversion sequence. */
4077 for (t = &std_seq; (*t)->kind != ck_identity; t = &((*t)->u.next))
4078 {
4079 /* The entire sequence is a user-conversion sequence. */
4080 (*t)->user_conv_p = true;
4081 if (bad)
4082 (*t)->bad_p = true;
4083 }
4084
4085 if ((*t)->rvaluedness_matches_p)
4086 /* We're binding a reference directly to the result of the conversion.
4087 build_user_type_conversion_1 stripped the REFERENCE_TYPE from the return
4088 type, but we want it back. */
4089 user_seq->type = TREE_TYPE (TREE_TYPE (user_seq->cand->fn))((contains_struct_check ((((contains_struct_check ((user_seq->
cand->fn), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4089, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4089, __FUNCTION__))->typed.type)
;
4090
4091 /* Replace the identity conversion with the user conversion
4092 sequence. */
4093 *t = user_seq;
4094
4095 return std_seq;
4096}
4097
4098/* Handle overload resolution for initializing an object of class type from
4099 an initializer list. First we look for a suitable constructor that
4100 takes a std::initializer_list; if we don't find one, we then look for a
4101 non-list constructor.
4102
4103 Parameters are as for add_candidates, except that the arguments are in
4104 the form of a CONSTRUCTOR (the initializer list) rather than a vector, and
4105 the RETURN_TYPE parameter is replaced by TOTYPE, the desired type. */
4106
4107static void
4108add_list_candidates (tree fns, tree first_arg,
4109 const vec<tree, va_gc> *args, tree totype,
4110 tree explicit_targs, bool template_only,
4111 tree conversion_path, tree access_path,
4112 int flags,
4113 struct z_candidate **candidates,
4114 tsubst_flags_t complain)
4115{
4116 gcc_assert (*candidates == NULL)((void)(!(*candidates == __null) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4116, __FUNCTION__), 0 : 0))
;
4117
4118 /* We're looking for a ctor for list-initialization. */
4119 flags |= LOOKUP_LIST_INIT_CTOR(((1 << 6) << 1) << 1);
4120 /* And we don't allow narrowing conversions. We also use this flag to
4121 avoid the copy constructor call for copy-list-initialization. */
4122 flags |= LOOKUP_NO_NARROWING((1 << 6) << 1);
4123
4124 unsigned nart = num_artificial_parms_for (OVL_FIRST (fns)ovl_first (fns)) - 1;
4125 tree init_list = (*args)[nart];
4126
4127 /* Always use the default constructor if the list is empty (DR 990). */
4128 if (CONSTRUCTOR_NELTS (init_list)(vec_safe_length (((tree_check ((init_list), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4128, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
== 0
4129 && TYPE_HAS_DEFAULT_CONSTRUCTOR (totype)((((tree_class_check ((totype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4129, __FUNCTION__))->type_with_lang_specific.lang_specific
))->has_default_ctor)
)
4130 ;
4131 /* If the class has a list ctor, try passing the list as a single
4132 argument first, but only consider list ctors. */
4133 else if (TYPE_HAS_LIST_CTOR (totype)((((tree_class_check ((totype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4133, __FUNCTION__))->type_with_lang_specific.lang_specific
))->has_list_ctor)
)
4134 {
4135 flags |= LOOKUP_LIST_ONLY(((((1 << 6) << 1) << 1) << 1) <<
1)
;
4136 add_candidates (fns, first_arg, args, NULL_TREE(tree) __null,
4137 explicit_targs, template_only, conversion_path,
4138 access_path, flags, candidates, complain);
4139 if (any_strictly_viable (*candidates))
4140 return;
4141 }
4142 else if (CONSTRUCTOR_IS_DESIGNATED_INIT (init_list)(((tree_not_check2 (((tree_check ((init_list), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4142, __FUNCTION__, (CONSTRUCTOR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4142, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_6))
4143 && !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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4143, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((totype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4143, __FUNCTION__))->type_common.size) != (tree) __null
) && !((((tree_class_check ((totype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4143, __FUNCTION__))->type_with_lang_specific.lang_specific
))->non_aggregate)))
)
4144 {
4145 if (complain & tf_error)
4146 error ("designated initializers cannot be used with a "
4147 "non-aggregate type %qT", totype);
4148 return;
4149 }
4150
4151 /* Expand the CONSTRUCTOR into a new argument vec. */
4152 vec<tree, va_gc> *new_args;
4153 vec_alloc (new_args, nart + CONSTRUCTOR_NELTS (init_list)(vec_safe_length (((tree_check ((init_list), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4153, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
);
4154 for (unsigned i = 0; i < nart; ++i)
4155 new_args->quick_push ((*args)[i]);
4156 for (unsigned i = 0; i < CONSTRUCTOR_NELTS (init_list)(vec_safe_length (((tree_check ((init_list), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4156, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
; ++i)
4157 new_args->quick_push (CONSTRUCTOR_ELT (init_list, i)(&(*((tree_check ((init_list), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4157, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
i])
->value);
4158
4159 /* We aren't looking for list-ctors anymore. */
4160 flags &= ~LOOKUP_LIST_ONLY(((((1 << 6) << 1) << 1) << 1) <<
1)
;
4161 /* We allow more user-defined conversions within an init-list. */
4162 flags &= ~LOOKUP_NO_CONVERSION(1 << 4);
4163
4164 add_candidates (fns, first_arg, new_args, NULL_TREE(tree) __null,
4165 explicit_targs, template_only, conversion_path,
4166 access_path, flags, candidates, complain);
4167}
4168
4169/* Given C(std::initializer_list<A>), return A. */
4170
4171static tree
4172list_ctor_element_type (tree fn)
4173{
4174 gcc_checking_assert (is_list_ctor (fn))((void)(!(is_list_ctor (fn)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4174, __FUNCTION__), 0 : 0))
;
4175
4176 tree parm = FUNCTION_FIRST_USER_PARMTYPE (fn)skip_artificial_parms_for ((fn), ((tree_check2 ((((contains_struct_check
((fn), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4176, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4176, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values))
;
4177 parm = non_reference (TREE_VALUE (parm)((tree_check ((parm), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4177, __FUNCTION__, (TREE_LIST)))->list.value)
);
4178 return TREE_VEC_ELT (CLASSTYPE_TI_ARGS (parm), 0)(*((const_cast<tree *> (tree_vec_elt_check ((((struct tree_template_info
*)(tree_check (((((tree_class_check (((tree_check3 ((parm), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4178, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4178, __FUNCTION__))->type_non_common.lang_1))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4178, __FUNCTION__, (TEMPLATE_INFO))))->args), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4178, __FUNCTION__)))))
;
4179}
4180
4181/* If EXPR is a braced-init-list where the elements all decay to the same type,
4182 return that type. */
4183
4184static tree
4185braced_init_element_type (tree expr)
4186{
4187 if (TREE_CODE (expr)((enum tree_code) (expr)->base.code) == CONSTRUCTOR
4188 && TREE_CODE (TREE_TYPE (expr))((enum tree_code) (((contains_struct_check ((expr), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4188, __FUNCTION__))->typed.type))->base.code)
== ARRAY_TYPE)
4189 return TREE_TYPE (TREE_TYPE (expr))((contains_struct_check ((((contains_struct_check ((expr), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4189, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4189, __FUNCTION__))->typed.type)
;
4190 if (!BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4190, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
)
4191 return NULL_TREE(tree) __null;
4192
4193 tree elttype = NULL_TREE(tree) __null;
4194 for (constructor_elt &e: CONSTRUCTOR_ELTS (expr)((tree_check ((expr), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4194, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
)
4195 {
4196 tree type = TREE_TYPE (e.value)((contains_struct_check ((e.value), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4196, __FUNCTION__))->typed.type)
;
4197 type = type_decays_to (type);
4198 if (!elttype)
4199 elttype = type;
4200 else if (!same_type_p (type, elttype)comptypes ((type), (elttype), 0))
4201 return NULL_TREE(tree) __null;
4202 }
4203 return elttype;
4204}
4205
4206/* True iff EXPR contains any temporaries with non-trivial destruction.
4207
4208 ??? Also ignore classes with non-trivial but no-op destruction other than
4209 std::allocator? */
4210
4211static bool
4212has_non_trivial_temporaries (tree expr)
4213{
4214 auto_vec<tree*> temps;
4215 cp_walk_tree_without_duplicates (&expr, find_temps_r, &temps)walk_tree_without_duplicates_1 (&expr, find_temps_r, &
temps, cp_walk_subtrees)
;
4216 for (tree *p : temps)
4217 {
4218 tree t = TREE_TYPE (*p)((contains_struct_check ((*p), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4218, __FUNCTION__))->typed.type)
;
4219 if (!TYPE_HAS_TRIVIAL_DESTRUCTOR (t)(!(((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4219, __FUNCTION__))->type_common.lang_flag_4)))
4220 && !is_std_allocator (t))
4221 return true;
4222 }
4223 return false;
4224}
4225
4226/* We're initializing an array of ELTTYPE from INIT. If it seems useful,
4227 return INIT as an array (of its own type) so the caller can initialize the
4228 target array in a loop. */
4229
4230static tree
4231maybe_init_list_as_array (tree elttype, tree init)
4232{
4233 /* Only do this if the array can go in rodata but not once converted. */
4234 if (!TYPE_NON_AGGREGATE_CLASS (elttype)((((((enum tree_code) (elttype)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (elttype)->base.code)) == UNION_TYPE
) && ((tree_class_check ((elttype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4234, __FUNCTION__))->type_common.lang_flag_5)) &&
((((tree_class_check ((elttype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4234, __FUNCTION__))->type_with_lang_specific.lang_specific
))->non_aggregate))
)
4235 return NULL_TREE(tree) __null;
4236 tree init_elttype = braced_init_element_type (init);
4237 if (!init_elttype || !SCALAR_TYPE_P (init_elttype)((((enum tree_code) (init_elttype)->base.code) == OFFSET_TYPE
) || ((enum tree_code) (init_elttype)->base.code) == ENUMERAL_TYPE
|| ((((enum tree_code) (init_elttype)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (init_elttype)->base.code) == INTEGER_TYPE
) || ((enum tree_code) (init_elttype)->base.code) == REAL_TYPE
|| ((enum tree_code) (init_elttype)->base.code) == COMPLEX_TYPE
) || (((enum tree_code) (init_elttype)->base.code) == POINTER_TYPE
) || (((enum tree_code) (init_elttype)->base.code) == RECORD_TYPE
&& (((tree_class_check (((tree_check ((init_elttype)
, "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4237, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4237, __FUNCTION__))->type_common.lang_flag_2))) || (((enum
tree_code) (init_elttype)->base.code) == NULLPTR_TYPE))
|| !TREE_CONSTANT (init)((non_type_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4237, __FUNCTION__))->base.constant_flag)
)
4238 return NULL_TREE(tree) __null;
4239
4240 /* Check with a stub expression to weed out special cases, and check whether
4241 we call the same function for direct-init as copy-list-init. */
4242 conversion_obstack_sentinel cos;
4243 tree arg = build_stub_object (init_elttype);
4244 conversion *c = implicit_conversion (elttype, init_elttype, arg, false,
4245 LOOKUP_NORMAL((1 << 0)), tf_none);
4246 if (c && c->kind == ck_rvalue)
4247 c = next_conversion (c);
4248 if (!c || c->kind != ck_user)
4249 return NULL_TREE(tree) __null;
4250
4251 tree first = CONSTRUCTOR_ELT (init, 0)(&(*((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4251, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
0])
->value;
4252 conversion *fc = implicit_conversion (elttype, init_elttype, first, false,
4253 LOOKUP_IMPLICIT(((1 << 0)) | (1 << 2))|LOOKUP_NO_NARROWING((1 << 6) << 1),
4254 tf_none);
4255 if (fc && fc->kind == ck_rvalue)
4256 fc = next_conversion (fc);
4257 if (!fc || fc->kind != ck_user || fc->cand->fn != c->cand->fn)
4258 return NULL_TREE(tree) __null;
4259 first = convert_like (fc, first, tf_none);
4260 if (first == error_mark_nodeglobal_trees[TI_ERROR_MARK])
4261 /* Let the normal code give the error. */
4262 return NULL_TREE(tree) __null;
4263
4264 /* Don't do this if the conversion would be constant. */
4265 first = maybe_constant_init (first);
4266 if (TREE_CONSTANT (first)((non_type_check ((first), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4266, __FUNCTION__))->base.constant_flag)
)
4267 return NULL_TREE(tree) __null;
4268
4269 /* We can't do this if the conversion creates temporaries that need
4270 to live until the whole array is initialized. */
4271 if (has_non_trivial_temporaries (first))
4272 return NULL_TREE(tree) __null;
4273
4274 init_elttype = cp_build_qualified_type (init_elttype, TYPE_QUAL_CONST);
4275 tree arr = build_array_of_n_type (init_elttype, CONSTRUCTOR_NELTS (init)(vec_safe_length (((tree_check ((init), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4275, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
);
4276 return finish_compound_literal (arr, init, tf_none);
4277}
4278
4279/* If we were going to call e.g. vector(initializer_list<string>) starting
4280 with a list of string-literals (which is inefficient, see PR105838),
4281 instead build an array of const char* and pass it to the range constructor.
4282 But only do this for standard library types, where we can assume the
4283 transformation makes sense.
4284
4285 Really the container classes should have initializer_list<U> constructors to
4286 get the same effect more simply; this is working around that lack. */
4287
4288static tree
4289maybe_init_list_as_range (tree fn, tree expr)
4290{
4291 if (!processing_template_declscope_chain->x_processing_template_decl
4292 && BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4292, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
4293 && is_list_ctor (fn)
4294 && decl_in_std_namespace_p (fn))
4295 {
4296 tree to = list_ctor_element_type (fn);
4297 if (tree init = maybe_init_list_as_array (to, expr))
4298 {
4299 tree begin = decay_conversion (TARGET_EXPR_SLOT (init)(*(tree_operand_check_code ((init), (TARGET_EXPR), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4299, __FUNCTION__)))
, tf_none);
4300 tree nelts = array_type_nelts_top (TREE_TYPE (init)((contains_struct_check ((init), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4300, __FUNCTION__))->typed.type)
);
4301 tree end = cp_build_binary_op (input_location, PLUS_EXPR, begin,
4302 nelts, tf_none);
4303 begin = cp_build_compound_expr (init, begin, tf_none);
4304 return build_constructor_va (init_list_type_nodecp_global_trees[CPTI_INIT_LIST_TYPE], 2,
4305 NULL_TREE(tree) __null, begin, NULL_TREE(tree) __null, end);
4306 }
4307 }
4308
4309 return NULL_TREE(tree) __null;
4310}
4311
4312/* Returns the best overload candidate to perform the requested
4313 conversion. This function is used for three the overloading situations
4314 described in [over.match.copy], [over.match.conv], and [over.match.ref].
4315 If TOTYPE is a REFERENCE_TYPE, we're trying to find a direct binding as
4316 per [dcl.init.ref], so we ignore temporary bindings. */
4317
4318static struct z_candidate *
4319build_user_type_conversion_1 (tree totype, tree expr, int flags,
4320 tsubst_flags_t complain)
4321{
4322 struct z_candidate *candidates, *cand;
4323 tree fromtype;
4324 tree ctors = NULL_TREE(tree) __null;
4325 tree conv_fns = NULL_TREE(tree) __null;
4326 conversion *conv = NULL__null;
4327 tree first_arg = NULL_TREE(tree) __null;
4328 vec<tree, va_gc> *args = NULL__null;
4329 bool any_viable_p;
4330 int convflags;
4331
4332 if (!expr)
4333 return NULL__null;
4334
4335 fromtype = TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4335, __FUNCTION__))->typed.type)
;
4336
4337 /* We represent conversion within a hierarchy using RVALUE_CONV and
4338 BASE_CONV, as specified by [over.best.ics]; these become plain
4339 constructor calls, as specified in [dcl.init]. */
4340 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) == TRAIT_TYPE
|| ((enum tree_code) (fromtype)->base.code) == DEPENDENT_OPERATOR_TYPE
) || (((((enum tree_code) (fromtype)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (fromtype)->base.code)) == UNION_TYPE
) && ((tree_class_check ((fromtype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4340, __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) == TRAIT_TYPE ||
((enum tree_code) (totype)->base.code) == DEPENDENT_OPERATOR_TYPE
) || (((((enum tree_code) (totype)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (totype)->base.code)) == UNION_TYPE
) && ((tree_class_check ((totype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4340, __FUNCTION__))->type_common.lang_flag_5))) || !(lookup_base
((fromtype), (totype), ba_any, __null, tf_none) != (tree) __null
)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4341, __FUNCTION__), 0 : 0))
4341 || !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) == TRAIT_TYPE
|| ((enum tree_code) (fromtype)->base.code) == DEPENDENT_OPERATOR_TYPE
) || (((((enum tree_code) (fromtype)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (fromtype)->base.code)) == UNION_TYPE
) && ((tree_class_check ((fromtype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4340, __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) == TRAIT_TYPE ||
((enum tree_code) (totype)->base.code) == DEPENDENT_OPERATOR_TYPE
) || (((((enum tree_code) (totype)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (totype)->base.code)) == UNION_TYPE
) && ((tree_class_check ((totype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4340, __FUNCTION__))->type_common.lang_flag_5))) || !(lookup_base
((fromtype), (totype), ba_any, __null, tf_none) != (tree) __null
)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4341, __FUNCTION__), 0 : 0))
;
4342
4343 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4343, __FUNCTION__))->type_common.lang_flag_5))
)
4344 /* Use lookup_fnfields_slot instead of lookup_fnfields to avoid
4345 creating a garbage BASELINK; constructors can't be inherited. */
4346 ctors = get_class_binding (totype, complete_ctor_identifiercp_global_trees[CPTI_COMPLETE_CTOR_IDENTIFIER]);
4347
4348 tree to_nonref = non_reference (totype);
4349 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) == TRAIT_TYPE
|| ((enum tree_code) (fromtype)->base.code) == DEPENDENT_OPERATOR_TYPE
) || (((((enum tree_code) (fromtype)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (fromtype)->base.code)) == UNION_TYPE
) && ((tree_class_check ((fromtype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4349, __FUNCTION__))->type_common.lang_flag_5)))
)
4350 {
4351 if (same_type_ignoring_top_level_qualifiers_p (to_nonref, fromtype) ||
4352 (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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4352, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4352, __FUNCTION__))->type_common.lang_flag_5))
4353 && DERIVED_FROM_P (to_nonref, fromtype)(lookup_base ((fromtype), (to_nonref), ba_any, __null, tf_none
) != (tree) __null)
))
4354 {
4355 /* [class.conv.fct] A conversion function is never used to
4356 convert a (possibly cv-qualified) object to the (possibly
4357 cv-qualified) same object type (or a reference to it), to a
4358 (possibly cv-qualified) base class of that type (or a
4359 reference to it)... */
4360 }
4361 else
4362 conv_fns = lookup_conversions (fromtype);
4363 }
4364
4365 candidates = 0;
4366 flags |= LOOKUP_NO_CONVERSION(1 << 4);
4367 if (BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4367, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
)
4368 flags |= LOOKUP_NO_NARROWING((1 << 6) << 1);
4369 /* Prevent add_candidates from treating a non-strictly viable candidate
4370 as unviable. */
4371 complain |= tf_conv;
4372
4373 /* It's OK to bind a temporary for converting constructor arguments, but
4374 not in converting the return value of a conversion operator. */
4375 convflags = ((flags & LOOKUP_NO_TEMP_BIND(1 << 6)) | LOOKUP_NO_CONVERSION(1 << 4)
4376 | (flags & LOOKUP_NO_NARROWING((1 << 6) << 1)));
4377 flags &= ~LOOKUP_NO_TEMP_BIND(1 << 6);
4378
4379 if (ctors)
4380 {
4381 int ctorflags = flags;
4382
4383 first_arg = build_dummy_object (totype);
4384
4385 /* We should never try to call the abstract or base constructor
4386 from here. */
4387 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)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4387, __FUNCTION__, (TEMPLATE_DECL))))))))->result : ovl_first
(ctors))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4387, __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)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4387, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((ovl_first
(ctors)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4387, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4387, __FUNCTION__); &lt->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)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4388, __FUNCTION__, (TEMPLATE_DECL))))))))->result : ovl_first
(ctors))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4388, __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)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4388, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((ovl_first
(ctors)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4388, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4388, __FUNCTION__); &lt->u.fn; })->has_vtt_parm_p
)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4388, __FUNCTION__), 0 : 0))
4388 && !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)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4387, __FUNCTION__, (TEMPLATE_DECL))))))))->result : ovl_first
(ctors))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4387, __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)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4387, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((ovl_first
(ctors)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4387, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4387, __FUNCTION__); &lt->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)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4388, __FUNCTION__, (TEMPLATE_DECL))))))))->result : ovl_first
(ctors))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4388, __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)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4388, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((ovl_first
(ctors)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4388, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4388, __FUNCTION__); &lt->u.fn; })->has_vtt_parm_p
)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4388, __FUNCTION__), 0 : 0))
;
4389
4390 args = make_tree_vector_single (expr);
4391 if (BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4391, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
)
4392 {
4393 /* List-initialization. */
4394 add_list_candidates (ctors, first_arg, args, totype, NULL_TREE(tree) __null,
4395 false, TYPE_BINFO (totype)((tree_check3 ((totype), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4395, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.maxval)
, TYPE_BINFO (totype)((tree_check3 ((totype), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4395, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.maxval)
,
4396 ctorflags, &candidates, complain);
4397 }
4398 else
4399 {
4400 add_candidates (ctors, first_arg, args, NULL_TREE(tree) __null, NULL_TREE(tree) __null, false,
4401 TYPE_BINFO (totype)((tree_check3 ((totype), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4401, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.maxval)
, TYPE_BINFO (totype)((tree_check3 ((totype), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4401, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.maxval)
,
4402 ctorflags, &candidates, complain);
4403 }
4404
4405 for (cand = candidates; cand; cand = cand->next)
4406 {
4407 cand->second_conv = build_identity_conv (totype, NULL_TREE(tree) __null);
4408
4409 /* If totype isn't a reference, and LOOKUP_ONLYCONVERTING is
4410 set, then this is copy-initialization. In that case, "The
4411 result of the call is then used to direct-initialize the
4412 object that is the destination of the copy-initialization."
4413 [dcl.init]
4414
4415 We represent this in the conversion sequence with an
4416 rvalue conversion, which means a constructor call. */
4417 if (!TYPE_REF_P (totype)(((enum tree_code) (totype)->base.code) == REFERENCE_TYPE)
4418 && cxx_dialect < cxx17
4419 && (flags & LOOKUP_ONLYCONVERTING(1 << 2))
4420 && !(convflags & LOOKUP_NO_TEMP_BIND(1 << 6)))
4421 cand->second_conv
4422 = build_conv (ck_rvalue, totype, cand->second_conv);
4423 }
4424 }
4425
4426 if (conv_fns)
4427 {
4428 if (BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4428, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
)
4429 first_arg = CONSTRUCTOR_ELT (expr, 0)(&(*((tree_check ((expr), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4429, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
0])
->value;
4430 else
4431 first_arg = expr;
4432 }
4433
4434 for (; conv_fns; conv_fns = TREE_CHAIN (conv_fns)((contains_struct_check ((conv_fns), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4434, __FUNCTION__))->common.chain)
)
4435 {
4436 tree conversion_path = TREE_PURPOSE (conv_fns)((tree_check ((conv_fns), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4436, __FUNCTION__, (TREE_LIST)))->list.purpose)
;
4437 struct z_candidate *old_candidates;
4438
4439 /* If LOOKUP_NO_CONVERSION, don't consider a conversion function that
4440 would need an addional user-defined conversion, i.e. if the return
4441 type differs in class-ness from the desired type. So we avoid
4442 considering operator bool when calling a copy constructor.
4443
4444 This optimization avoids the failure in PR97600, and is allowed by
4445 [temp.inst]/9: "If the function selected by overload resolution can be
4446 determined without instantiating a class template definition, it is
4447 unspecified whether that instantiation actually takes place." */
4448 tree convtype = non_reference (TREE_TYPE (conv_fns)((contains_struct_check ((conv_fns), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4448, __FUNCTION__))->typed.type)
);
4449 if ((flags & LOOKUP_NO_CONVERSION(1 << 4))
4450 && !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
|| ((enum tree_code) (convtype)->base.code) == TRAIT_TYPE
|| ((enum tree_code) (convtype)->base.code) == DEPENDENT_OPERATOR_TYPE
)
4451 && (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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4451, __FUNCTION__))->type_common.lang_flag_5))
4452 != 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4452, __FUNCTION__))->type_common.lang_flag_5))
))
4453 continue;
4454
4455 /* If we are called to convert to a reference type, we are trying to
4456 find a direct binding, so don't even consider temporaries. If
4457 we don't find a direct binding, the caller will try again to
4458 look for a temporary binding. */
4459 if (TYPE_REF_P (totype)(((enum tree_code) (totype)->base.code) == REFERENCE_TYPE))
4460 convflags |= LOOKUP_NO_TEMP_BIND(1 << 6);
4461
4462 old_candidates = candidates;
4463 add_candidates (TREE_VALUE (conv_fns)((tree_check ((conv_fns), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4463, __FUNCTION__, (TREE_LIST)))->list.value)
, first_arg, NULL__null, totype,
4464 NULL_TREE(tree) __null, false,
4465 conversion_path, TYPE_BINFO (fromtype)((tree_check3 ((fromtype), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4465, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.maxval)
,
4466 flags, &candidates, complain);
4467
4468 for (cand = candidates; cand != old_candidates; cand = cand->next)
4469 {
4470 if (cand->viable == 0)
4471 /* Already rejected, don't change to -1. */
4472 continue;
4473
4474 tree rettype = TREE_TYPE (TREE_TYPE (cand->fn))((contains_struct_check ((((contains_struct_check ((cand->
fn), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4474, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4474, __FUNCTION__))->typed.type)
;
4475 conversion *ics
4476 = implicit_conversion (totype,
4477 rettype,
4478 0,
4479 /*c_cast_p=*/false, convflags,
4480 complain);
4481
4482 /* If LOOKUP_NO_TEMP_BIND isn't set, then this is
4483 copy-initialization. In that case, "The result of the
4484 call is then used to direct-initialize the object that is
4485 the destination of the copy-initialization." [dcl.init]
4486
4487 We represent this in the conversion sequence with an
4488 rvalue conversion, which means a constructor call. But
4489 don't add a second rvalue conversion if there's already
4490 one there. Which there really shouldn't be, but it's
4491 harmless since we'd add it here anyway. */
4492 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) == TRAIT_TYPE ||
((enum tree_code) (totype)->base.code) == DEPENDENT_OPERATOR_TYPE
) || (((((enum tree_code) (totype)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (totype)->base.code)) == UNION_TYPE
) && ((tree_class_check ((totype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4492, __FUNCTION__))->type_common.lang_flag_5)))
&& ics->kind != ck_rvalue
4493 && !(convflags & LOOKUP_NO_TEMP_BIND(1 << 6)))
4494 ics = build_conv (ck_rvalue, totype, ics);
4495
4496 cand->second_conv = ics;
4497
4498 if (!ics)
4499 {
4500 cand->viable = 0;
4501 cand->reason = arg_conversion_rejection (NULL_TREE(tree) __null, -2,
4502 rettype, totype,
4503 EXPR_LOCATION (expr)((((expr)) && ((tree_code_type_tmpl <0>::tree_code_type
[(int) (((enum tree_code) ((expr))->base.code))]) >= tcc_reference
&& (tree_code_type_tmpl <0>::tree_code_type[(int
) (((enum tree_code) ((expr))->base.code))]) <= tcc_expression
)) ? (expr)->exp.locus : ((location_t) 0))
);
4504 }
4505 else if (TYPE_REF_P (totype)(((enum tree_code) (totype)->base.code) == REFERENCE_TYPE) && !ics->rvaluedness_matches_p
4506 /* Limit this to non-templates for now (PR90546). */
4507 && !cand->template_decl
4508 && TREE_CODE (TREE_TYPE (totype))((enum tree_code) (((contains_struct_check ((totype), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4508, __FUNCTION__))->typed.type))->base.code)
!= FUNCTION_TYPE)
4509 {
4510 /* If we are called to convert to a reference type, we are trying
4511 to find a direct binding per [over.match.ref], so rvaluedness
4512 must match for non-functions. */
4513 cand->viable = 0;
4514 }
4515 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4515, __FUNCTION__, (TEMPLATE_DECL))))))))->result : cand
->fn)), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4515, __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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4515, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((cand
->fn), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4515, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4515, __FUNCTION__); &lt->u.fn; })->nonconverting
)
4516 && ics->rank > cr_exact)
4517 {
4518 /* 13.3.1.5: For direct-initialization, those explicit
4519 conversion functions that are not hidden within S and
4520 yield type T or a type that can be converted to type T
4521 with a qualification conversion (4.4) are also candidate
4522 functions. */
4523 /* 13.3.1.6 doesn't have a parallel restriction, but it should;
4524 I've raised this issue with the committee. --jason 9/2011 */
4525 cand->viable = -1;
4526 cand->reason = explicit_conversion_rejection (rettype, totype);
4527 }
4528 else if (cand->viable == 1 && ics->bad_p)
4529 {
4530 cand->viable = -1;
4531 cand->reason
4532 = bad_arg_conversion_rejection (NULL_TREE(tree) __null, -2,
4533 rettype, totype,
4534 EXPR_LOCATION (expr)((((expr)) && ((tree_code_type_tmpl <0>::tree_code_type
[(int) (((enum tree_code) ((expr))->base.code))]) >= tcc_reference
&& (tree_code_type_tmpl <0>::tree_code_type[(int
) (((enum tree_code) ((expr))->base.code))]) <= tcc_expression
)) ? (expr)->exp.locus : ((location_t) 0))
);
4535 }
4536 else if (primary_template_specialization_p (cand->fn)
4537 && ics->rank > cr_exact)
4538 {
4539 /* 13.3.3.1.2: If the user-defined conversion is specified by
4540 a specialization of a conversion function template, the
4541 second standard conversion sequence shall have exact match
4542 rank. */
4543 cand->viable = -1;
4544 cand->reason = template_conversion_rejection (rettype, totype);
4545 }
4546 }
4547 }
4548
4549 candidates = splice_viable (candidates, false, &any_viable_p);
4550 if (!any_viable_p)
4551 {
4552 if (args)
4553 release_tree_vector (args);
4554 return NULL__null;
4555 }
4556
4557 cand = tourney (candidates, complain);
4558 if (cand == NULL__null)
4559 {
4560 if (complain & tf_error)
4561 {
4562 auto_diagnostic_group d;
4563 error_at (cp_expr_loc_or_input_loc (expr),
4564 "conversion from %qH to %qI is ambiguous",
4565 fromtype, totype);
4566 print_z_candidates (location_of (expr), candidates);
4567 }
4568
4569 cand = candidates; /* any one will do */
4570 cand->second_conv = build_ambiguous_conv (totype, expr);
4571 cand->second_conv->user_conv_p = true;
4572 if (!any_strictly_viable (candidates))
4573 cand->second_conv->bad_p = true;
4574 if (flags & LOOKUP_ONLYCONVERTING(1 << 2))
4575 cand->second_conv->need_temporary_p = true;
4576 /* If there are viable candidates, don't set ICS_BAD_FLAG; an
4577 ambiguous conversion is no worse than another user-defined
4578 conversion. */
4579
4580 return cand;
4581 }
4582
4583 /* Maybe pass { } as iterators instead of an initializer_list. */
4584 if (tree iters = maybe_init_list_as_range (cand->fn, expr))
4585 if (z_candidate *cand2
4586 = build_user_type_conversion_1 (totype, iters, flags, tf_none))
4587 if (cand2->viable == 1 && !is_list_ctor (cand2->fn))
4588 {
4589 cand = cand2;
4590 expr = iters;
4591 }
4592
4593 tree convtype;
4594 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4594, __FUNCTION__, (TEMPLATE_DECL))))))))->result : cand
->fn)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4594, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
)
4595 convtype = non_reference (TREE_TYPE (TREE_TYPE (cand->fn))((contains_struct_check ((((contains_struct_check ((cand->
fn), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4595, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4595, __FUNCTION__))->typed.type)
);
4596 else if (cand->second_conv->kind == ck_rvalue)
4597 /* DR 5: [in the first step of copy-initialization]...if the function
4598 is a constructor, the call initializes a temporary of the
4599 cv-unqualified version of the destination type. */
4600 convtype = cv_unqualified (totype);
4601 else
4602 convtype = totype;
4603 /* Build the user conversion sequence. */
4604 conv = build_conv
4605 (ck_user,
4606 convtype,
4607 build_identity_conv (TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4607, __FUNCTION__))->typed.type)
, expr));
4608 conv->cand = cand;
4609 if (cand->viable == -1)
4610 conv->bad_p = true;
4611
4612 /* Remember that this was a list-initialization. */
4613 if (flags & LOOKUP_NO_NARROWING((1 << 6) << 1))
4614 conv->check_narrowing = true;
4615
4616 /* Combine it with the second conversion sequence. */
4617 cand->second_conv = merge_conversion_sequences (conv,
4618 cand->second_conv);
4619
4620 return cand;
4621}
4622
4623/* Wrapper for above. */
4624
4625tree
4626build_user_type_conversion (tree totype, tree expr, int flags,
4627 tsubst_flags_t complain)
4628{
4629 struct z_candidate *cand;
4630 tree ret;
4631
4632 auto_cond_timevar tv (TV_OVERLOAD);
4633 cand = build_user_type_conversion_1 (totype, expr, flags, complain);
4634
4635 if (cand)
4636 {
4637 if (cand->second_conv->kind == ck_ambig)
4638 ret = error_mark_nodeglobal_trees[TI_ERROR_MARK];
4639 else
4640 {
4641 expr = convert_like (cand->second_conv, expr, complain);
4642 ret = convert_from_reference (expr);
4643 }
4644 }
4645 else
4646 ret = NULL_TREE(tree) __null;
4647
4648 return ret;
4649}
4650
4651/* Give a helpful diagnostic when implicit_conversion fails. */
4652
4653static void
4654implicit_conversion_error (location_t loc, tree type, tree expr)
4655{
4656 tsubst_flags_t complain = tf_warning_or_error;
4657
4658 /* If expr has unknown type, then it is an overloaded function.
4659 Call instantiate_type to get good error messages. */
4660 if (TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4660, __FUNCTION__))->typed.type)
== unknown_type_nodecp_global_trees[CPTI_UNKNOWN_TYPE])
4661 instantiate_type (type, expr, complain);
4662 else if (invalid_nonstatic_memfn_p (loc, expr, complain))
4663 /* We gave an error. */;
4664 else if (BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4664, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
4665 && CONSTRUCTOR_IS_DESIGNATED_INIT (expr)(((tree_not_check2 (((tree_check ((expr), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4665, __FUNCTION__, (CONSTRUCTOR)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4665, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_6))
4666 && !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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4666, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4666, __FUNCTION__))->type_common.size) != (tree) __null
) && !((((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4666, __FUNCTION__))->type_with_lang_specific.lang_specific
))->non_aggregate)))
)
4667 error_at (loc, "designated initializers cannot be used with a "
4668 "non-aggregate type %qT", type);
4669 else
4670 {
4671 range_label_for_type_mismatch label (TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4671, __FUNCTION__))->typed.type)
, type);
4672 gcc_rich_location rich_loc (loc, &label);
4673 error_at (&rich_loc, "could not convert %qE from %qH to %qI",
4674 expr, TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4674, __FUNCTION__))->typed.type)
, type);
4675 }
4676}
4677
4678/* Worker for build_converted_constant_expr. */
4679
4680static tree
4681build_converted_constant_expr_internal (tree type, tree expr,
4682 int flags, tsubst_flags_t complain)
4683{
4684 conversion *conv;
4685 void *p;
4686 tree t;
4687 location_t loc = cp_expr_loc_or_input_loc (expr);
4688
4689 if (error_operand_p (expr))
4690 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4691
4692 /* Get the high-water mark for the CONVERSION_OBSTACK. */
4693 p = conversion_obstack_alloc (0);
4694
4695 conv = implicit_conversion (type, TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4695, __FUNCTION__))->typed.type)
, expr,
4696 /*c_cast_p=*/false, flags, complain);
4697
4698 /* A converted constant expression of type T is an expression, implicitly
4699 converted to type T, where the converted expression is a constant
4700 expression and the implicit conversion sequence contains only
4701
4702 * user-defined conversions,
4703 * lvalue-to-rvalue conversions (7.1),
4704 * array-to-pointer conversions (7.2),
4705 * function-to-pointer conversions (7.3),
4706 * qualification conversions (7.5),
4707 * integral promotions (7.6),
4708 * integral conversions (7.8) other than narrowing conversions (11.6.4),
4709 * null pointer conversions (7.11) from std::nullptr_t,
4710 * null member pointer conversions (7.12) from std::nullptr_t, and
4711 * function pointer conversions (7.13),
4712
4713 and where the reference binding (if any) binds directly. */
4714
4715 for (conversion *c = conv;
4716 c && c->kind != ck_identity;
4717 c = next_conversion (c))
4718 {
4719 switch (c->kind)
4720 {
4721 /* A conversion function is OK. If it isn't constexpr, we'll
4722 complain later that the argument isn't constant. */
4723 case ck_user:
4724 /* List-initialization is OK. */
4725 case ck_aggr:
4726 /* The lvalue-to-rvalue conversion is OK. */
4727 case ck_rvalue:
4728 /* Array-to-pointer and function-to-pointer. */
4729 case ck_lvalue:
4730 /* Function pointer conversions. */
4731 case ck_fnptr:
4732 /* Qualification conversions. */
4733 case ck_qual:
4734 break;
4735
4736 case ck_ref_bind:
4737 if (c->need_temporary_p)
4738 {
4739 if (complain & tf_error)
4740 error_at (loc, "initializing %qH with %qI in converted "
4741 "constant expression does not bind directly",
4742 type, next_conversion (c)->type);
4743 conv = NULL__null;
4744 }
4745 break;
4746
4747 case ck_base:
4748 case ck_pmem:
4749 case ck_ptr:
4750 case ck_std:
4751 t = next_conversion (c)->type;
4752 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))
4753 && 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))
)
4754 /* Integral promotion or conversion. */
4755 break;
4756 if (NULLPTR_TYPE_P (t)(((enum tree_code) (t)->base.code) == NULLPTR_TYPE))
4757 /* Conversion from nullptr to pointer or pointer-to-member. */
4758 break;
4759
4760 if (complain & tf_error)
4761 error_at (loc, "conversion from %qH to %qI in a "
4762 "converted constant expression", t, type);
4763 /* fall through. */
4764
4765 default:
4766 conv = NULL__null;
4767 break;
4768 }
4769 }
4770
4771 /* Avoid confusing convert_nontype_argument by introducing
4772 a redundant conversion to the same reference type. */
4773 if (conv && conv->kind == ck_ref_bind
4774 && REFERENCE_REF_P (expr)((((enum tree_code) (expr)->base.code) == INDIRECT_REF) &&
((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
((expr), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4774, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4774, __FUNCTION__))->typed.type) && (((enum tree_code
) (((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
(((expr)), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4774, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4774, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
))
)
4775 {
4776 tree ref = TREE_OPERAND (expr, 0)(*((const_cast<tree*> (tree_operand_check ((expr), (0),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4776, __FUNCTION__)))))
;
4777 if (same_type_p (type, TREE_TYPE (ref))comptypes ((type), (((contains_struct_check ((ref), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4777, __FUNCTION__))->typed.type)), 0)
)
4778 return ref;
4779 }
4780
4781 if (conv)
4782 {
4783 /* Don't copy a class in a template. */
4784 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4784, __FUNCTION__))->type_common.lang_flag_5))
&& conv->kind == ck_rvalue
4785 && processing_template_declscope_chain->x_processing_template_decl)
4786 conv = next_conversion (conv);
4787
4788 /* Issuing conversion warnings for value-dependent expressions is
4789 likely too noisy. */
4790 warning_sentinel w (warn_conversionglobal_options.x_warn_conversion);
4791 conv->check_narrowing = true;
4792 conv->check_narrowing_const_only = true;
4793 expr = convert_like (conv, expr, complain);
4794 }
4795 else
4796 {
4797 if (complain & tf_error)
4798 implicit_conversion_error (loc, type, expr);
4799 expr = error_mark_nodeglobal_trees[TI_ERROR_MARK];
4800 }
4801
4802 /* Free all the conversions we allocated. */
4803 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); })
;
4804
4805 return expr;
4806}
4807
4808/* Subroutine of convert_nontype_argument.
4809
4810 EXPR is an expression used in a context that requires a converted
4811 constant-expression, such as a template non-type parameter. Do any
4812 necessary conversions (that are permitted for converted
4813 constant-expressions) to convert it to the desired type.
4814
4815 This function doesn't consider explicit conversion functions. If
4816 you mean to use "a contextually converted constant expression of type
4817 bool", use build_converted_constant_bool_expr.
4818
4819 If conversion is successful, returns the converted expression;
4820 otherwise, returns error_mark_node. */
4821
4822tree
4823build_converted_constant_expr (tree type, tree expr, tsubst_flags_t complain)
4824{
4825 return build_converted_constant_expr_internal (type, expr, LOOKUP_IMPLICIT(((1 << 0)) | (1 << 2)),
4826 complain);
4827}
4828
4829/* Used to create "a contextually converted constant expression of type
4830 bool". This differs from build_converted_constant_expr in that it
4831 also considers explicit conversion functions. */
4832
4833tree
4834build_converted_constant_bool_expr (tree expr, tsubst_flags_t complain)
4835{
4836 return build_converted_constant_expr_internal (boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], expr,
4837 LOOKUP_NORMAL((1 << 0)), complain);
4838}
4839
4840/* Do any initial processing on the arguments to a function call. */
4841
4842vec<tree, va_gc> *
4843resolve_args (vec<tree, va_gc> *args, tsubst_flags_t complain)
4844{
4845 unsigned int ix;
4846 tree arg;
4847
4848 FOR_EACH_VEC_SAFE_ELT (args, ix, arg)for (ix = 0; vec_safe_iterate ((args), (ix), &(arg)); ++(
ix))
4849 {
4850 if (error_operand_p (arg))
4851 return NULL__null;
4852 else if (VOID_TYPE_P (TREE_TYPE (arg))(((enum tree_code) (((contains_struct_check ((arg), (TS_TYPED
), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4852, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
)
)
4853 {
4854 if (complain & tf_error)
4855 error_at (cp_expr_loc_or_input_loc (arg),
4856 "invalid use of void expression");
4857 return NULL__null;
4858 }
4859 else if (invalid_nonstatic_memfn_p (EXPR_LOCATION (arg)((((arg)) && ((tree_code_type_tmpl <0>::tree_code_type
[(int) (((enum tree_code) ((arg))->base.code))]) >= tcc_reference
&& (tree_code_type_tmpl <0>::tree_code_type[(int
) (((enum tree_code) ((arg))->base.code))]) <= tcc_expression
)) ? (arg)->exp.locus : ((location_t) 0))
, arg, complain))
4860 return NULL__null;
4861
4862 /* Force auto deduction now. Omit tf_warning to avoid redundant
4863 deprecated warning on deprecated-14.C. */
4864 if (!mark_single_function (arg, complain & ~tf_warning))
4865 return NULL__null;
4866 }
4867 return args;
4868}
4869
4870/* Perform overload resolution on FN, which is called with the ARGS.
4871
4872 Return the candidate function selected by overload resolution, or
4873 NULL if the event that overload resolution failed. In the case
4874 that overload resolution fails, *CANDIDATES will be the set of
4875 candidates considered, and ANY_VIABLE_P will be set to true or
4876 false to indicate whether or not any of the candidates were
4877 viable.
4878
4879 The ARGS should already have gone through RESOLVE_ARGS before this
4880 function is called. */
4881
4882static struct z_candidate *
4883perform_overload_resolution (tree fn,
4884 const vec<tree, va_gc> *args,
4885 struct z_candidate **candidates,
4886 bool *any_viable_p, tsubst_flags_t complain)
4887{
4888 struct z_candidate *cand;
4889 tree explicit_targs;
4890 int template_only;
4891
4892 auto_cond_timevar tv (TV_OVERLOAD);
4893
4894 explicit_targs = NULL_TREE(tree) __null;
4895 template_only = 0;
4896
4897 *candidates = NULL__null;
4898 *any_viable_p = true;
4899
4900 /* Check FN. */
4901 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
("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4901, __FUNCTION__), 0 : 0))
;
4902
4903 if (TREE_CODE (fn)((enum tree_code) (fn)->base.code) == TEMPLATE_ID_EXPR)
4904 {
4905 explicit_targs = TREE_OPERAND (fn, 1)(*((const_cast<tree*> (tree_operand_check ((fn), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4905, __FUNCTION__)))))
;
4906 fn = TREE_OPERAND (fn, 0)(*((const_cast<tree*> (tree_operand_check ((fn), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4906, __FUNCTION__)))))
;
4907 template_only = 1;
4908 }
4909
4910 /* Add the various candidate functions. */
4911 add_candidates (fn, NULL_TREE(tree) __null, args, NULL_TREE(tree) __null,
4912 explicit_targs, template_only,
4913 /*conversion_path=*/NULL_TREE(tree) __null,
4914 /*access_path=*/NULL_TREE(tree) __null,
4915 LOOKUP_NORMAL((1 << 0)),
4916 candidates, complain);
4917
4918 *candidates = splice_viable (*candidates, false, any_viable_p);
4919 if (*any_viable_p)
4920 cand = tourney (*candidates, complain);
4921 else
4922 cand = NULL__null;
4923
4924 return cand;
4925}
4926
4927/* Print an error message about being unable to build a call to FN with
4928 ARGS. ANY_VIABLE_P indicates whether any candidate functions could
4929 be located; CANDIDATES is a possibly empty list of such
4930 functions. */
4931
4932static void
4933print_error_for_call_failure (tree fn, const vec<tree, va_gc> *args,
4934 struct z_candidate *candidates)
4935{
4936 tree targs = NULL_TREE(tree) __null;
4937 if (TREE_CODE (fn)((enum tree_code) (fn)->base.code) == TEMPLATE_ID_EXPR)
4938 {
4939 targs = TREE_OPERAND (fn, 1)(*((const_cast<tree*> (tree_operand_check ((fn), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4939, __FUNCTION__)))))
;
4940 fn = TREE_OPERAND (fn, 0)(*((const_cast<tree*> (tree_operand_check ((fn), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4940, __FUNCTION__)))))
;
4941 }
4942 tree name = OVL_NAME (fn)((contains_struct_check ((ovl_first (fn)), (TS_DECL_MINIMAL),
"/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4942, __FUNCTION__))->decl_minimal.name)
;
4943 location_t loc = location_of (name);
4944 if (targs)
4945 name = lookup_template_function (name, targs);
4946
4947 auto_diagnostic_group d;
4948 if (!any_strictly_viable (candidates))
4949 error_at (loc, "no matching function for call to %<%D(%A)%>",
4950 name, build_tree_list_vec (args));
4951 else
4952 error_at (loc, "call of overloaded %<%D(%A)%> is ambiguous",
4953 name, build_tree_list_vec (args));
4954 if (candidates)
4955 print_z_candidates (loc, candidates);
4956}
4957
4958/* Perform overload resolution on the set of deduction guides DGUIDES
4959 using ARGS. Returns the selected deduction guide, or error_mark_node
4960 if overload resolution fails. */
4961
4962tree
4963perform_dguide_overload_resolution (tree dguides, const vec<tree, va_gc> *args,
4964 tsubst_flags_t complain)
4965{
4966 z_candidate *candidates;
4967 bool any_viable_p;
4968 tree result;
4969
4970 gcc_assert (deduction_guide_p (OVL_FIRST (dguides)))((void)(!(deduction_guide_p (ovl_first (dguides))) ? fancy_abort
("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 4970, __FUNCTION__), 0 : 0))
;
4971
4972 /* Get the high-water mark for the CONVERSION_OBSTACK. */
4973 void *p = conversion_obstack_alloc (0);
4974
4975 z_candidate *cand = perform_overload_resolution (dguides, args, &candidates,
4976 &any_viable_p, complain);
4977 if (!cand)
4978 {
4979 if (complain & tf_error)
4980 print_error_for_call_failure (dguides, args, candidates);
4981 result = error_mark_nodeglobal_trees[TI_ERROR_MARK];
4982 }
4983 else
4984 result = cand->fn;
4985
4986 /* Free all the conversions we allocated. */
4987 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); })
;
4988
4989 return result;
4990}
4991
4992/* Return an expression for a call to FN (a namespace-scope function,
4993 or a static member function) with the ARGS. This may change
4994 ARGS. */
4995
4996tree
4997build_new_function_call (tree fn, vec<tree, va_gc> **args,
4998 tsubst_flags_t complain)
4999{
5000 struct z_candidate *candidates, *cand;
5001 bool any_viable_p;
5002 void *p;
5003 tree result;
5004
5005 if (args != NULL__null && *args != NULL__null)
5006 {
5007 *args = resolve_args (*args, complain);
5008 if (*args == NULL__null)
5009 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
5010 }
5011
5012 if (flag_tmglobal_options.x_flag_tm)
5013 tm_malloc_replacement (fn);
5014
5015 /* Get the high-water mark for the CONVERSION_OBSTACK. */
5016 p = conversion_obstack_alloc (0);
5017
5018 cand = perform_overload_resolution (fn, *args, &candidates, &any_viable_p,
5019 complain);
5020
5021 if (!cand)
5022 {
5023 if (complain & tf_error)
5024 {
5025 // If there is a single (non-viable) function candidate,
5026 // let the error be diagnosed by cp_build_function_call_vec.
5027 if (!any_viable_p && candidates && ! candidates->next
5028 && (TREE_CODE (candidates->fn)((enum tree_code) (candidates->fn)->base.code) == FUNCTION_DECL))
5029 return cp_build_function_call_vec (candidates->fn, args, complain);
5030
5031 // Otherwise, emit notes for non-viable candidates.
5032 print_error_for_call_failure (fn, *args, candidates);
5033 }
5034 result = error_mark_nodeglobal_trees[TI_ERROR_MARK];
5035 }
5036 else
5037 {
5038 result = build_over_call (cand, LOOKUP_NORMAL((1 << 0)), complain);
5039 }
5040
5041 if (flag_coroutinesglobal_options.x_flag_coroutines
5042 && result
5043 && TREE_CODE (result)((enum tree_code) (result)->base.code) == CALL_EXPR
5044 && 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 5044, __FUNCTION__, (CALL_EXPR)))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 5044, __FUNCTION__)))))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 5044, __FUNCTION__)))))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 5044, __FUNCTION__, (FUNCTION_DECL)))->function_decl.built_in_class
)
5045 == BUILT_IN_NORMAL)
5046 result = coro_validate_builtin_call (result);
5047
5048 /* Free all the conversions we allocated. */
5049 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); })
;
5050
5051 return result;
5052}
5053
5054/* Build a call to a global operator new. FNNAME is the name of the
5055 operator (either "operator new" or "operator new[]") and ARGS are
5056 the arguments provided. This may change ARGS. *SIZE points to the
5057 total number of bytes required by the allocation, and is updated if
5058 that is changed here. *COOKIE_SIZE is non-NULL if a cookie should
5059 be used. If this function determines that no cookie should be
5060 used, after all, *COOKIE_SIZE is set to NULL_TREE. If SIZE_CHECK
5061 is not NULL_TREE, it is evaluated before calculating the final
5062 array size, and if it fails, the array size is replaced with
5063 (size_t)-1 (usually triggering a std::bad_alloc exception). If FN
5064 is non-NULL, it will be set, upon return, to the allocation
5065 function called. */
5066
5067tree
5068build_operator_new_call (tree fnname, vec<tree, va_gc> **args,
5069 tree *size, tree *cookie_size,
5070 tree align_arg, tree size_check,
5071 tree *fn, tsubst_flags_t complain)
5072{
5073 tree original_size = *size;
5074 tree fns;
5075 struct z_candidate *candidates;
5076 struct z_candidate *cand = NULL__null;
5077 bool any_viable_p;
5078
5079 if (fn)
5080 *fn = NULL_TREE(tree) __null;
5081 /* Set to (size_t)-1 if the size check fails. */
5082 if (size_check != NULL_TREE(tree) __null)
5083 {
5084 tree errval = TYPE_MAX_VALUE (sizetype)((tree_check5 ((sizetype_tab[(int) stk_sizetype]), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.cc"
, 5084, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE
), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval
)
;
5085 if (cxx_dialect >= cxx11 && flag_exceptionsglobal_options.x_flag_exceptions)
5086 errval = throw_bad_array_new_length ();
5087 *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 )
5088 original_size, errval)fold_build3_loc (((location_t) 0), COND_EXPR, sizetype_tab[(int
) stk_sizetype], size_check, original_size, errval )
;
5089 }
5090 vec_safe_insert (*args, 0, *size);
5091 *args = resolve_args (*args, complain);
5092 if (*args == NULL__null)
5093 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
5094
5095 /* Based on:
5096
5097 [expr.new]
5098
5099 If this lookup fails to find the name, or if the allocated type
5100 is not a class type, the allocation function's name is looked
5101 up in the global scope.
5102
5103 we disregard block-scope declarations of "operator new". */
5104 fns = lookup_qualified_name (global_namespacecp_global_trees[CPTI_GLOBAL], fnname);
5105
5106 if (align_arg)
5107 {
5108 vec<tree, va_gc>* align_args
5109 = vec_copy_and_insert (*args, align_arg, 1);
5110 cand = perform_overload_resolution (fns, align_args, &candidates,
5111 &any_viable_p, tf_none);
5112 if (cand)
5113 *args = align_args;
5114 /* If no aligned allocation function matches, try again without the
5115 alignment. */
5116 }
5117
5118 /* Figure out what function is being called. */
5119 if (!cand)
5120 cand = perform_overload_resolution (fns, *args, &candidates, &any_viable_p,
5121 complain);
5122
5123 /* If no suitable function could be found, issue an error message
5124 and give up. */
5125