Message ID | 4F117518.6090700@oracle.com |
---|---|
State | New |
Headers | show |
So, the issue here is that fold_non_dependent_expr_sfinae checks potential_constant_expression, and doesn't fold anything which isn't one. One approach would be to only guard cxx_constant_value with require_potential_constant_expression within a template. Another approach would be to check potential_constant_expression at the same place that we check type/value_dependent_expression_p, i.e. in cp_finish_decl and convert_template_argument. Jason
Index: pt.c =================================================================== --- pt.c (revision 183178) +++ pt.c (working copy) @@ -5807,6 +5807,8 @@ convert_nontype_argument (tree type, tree expr, ts if (complain & tf_error) { int errs = errorcount, warns = warningcount; + if (!require_potential_constant_expression (expr)) + return NULL_TREE; expr = cxx_constant_value (expr); if (errorcount > errs || warningcount > warns) inform (EXPR_LOC_OR_HERE (expr),