On 2/8/19 6:18 PM, Jakub Jelinek wrote:
Hi!

Non-type template arguments are constant-expression in the grammar and thus
manifestly constant-evaluated.
For e.g. class templates, convert_nontype_argument is called with
tf_warning_or_error and so while we called in the below spots
maybe_constant_value without manifestly_const_eval=true, there is a
       if (TREE_CODE (expr) != INTEGER_CST
           && !value_dependent_expression_p (expr))
         {
           if (complain & tf_error)
             {
               int errs = errorcount, warns = warningcount + werrorcount;
               if (!require_potential_constant_expression (expr))
                 expr = error_mark_node;
               else
                 expr = cxx_constant_value (expr);
later on and cxx_constant_value will do the manifestly_const_eval=true.
On the testcase below with function template, complain is tf_none and
so we only call that maybe_constant_value and not cxx_constant_value.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

OK.

Reply via email to