On Mon, Oct 1, 2018 at 6:41 PM Marek Polacek <pola...@redhat.com> wrote: > > This patch implements C++20 explicit(bool), as described in: > <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0892r2.html>. > > I tried to follow the noexcept specifier implementation where I could, which > made the non-template parts of this fairly easy. To make explicit(expr) work > with dependent expressions, I had to add DECL_EXPLICIT_SPEC to lang_decl_fn, > which serves as a vessel to get the explicit-specifier to tsubst_function_decl > where I substitute the dependent arguments.
What's the impact of that on memory consumption? I'm nervous about adding another word to most functions when it's not useful to most of them. For several similar things we've been using hash tables on the side. > +/* Create a representation of the explicit-specifier with > + constant-expression of EXPR. COMPLAIN is as for tsubst. */ > + > +tree > +build_explicit_specifier (tree expr, tsubst_flags_t complain) > +{ > + if (processing_template_decl && value_dependent_expression_p (expr)) > + /* Wait for instantiation. tsubst_function_decl will take care of it. > */ > + return expr; > + > + expr = perform_implicit_conversion_flags (boolean_type_node, expr, > + complain, LOOKUP_NORMAL); > + expr = instantiate_non_dependent_expr (expr); > + expr = cxx_constant_value (expr); > + return expr; > +} Is there a reason not to use build_converted_constant_expr? Jason