On 12/30/18 11:08 AM, Marek Polacek wrote:
This PR points out that while we are able to deduce the template arguments
for A{}, we fail for A().
For A{}, the deduction happens in finish_compound_literal:
2789 if (tree anode = type_uses_auto (type))
2790 if (CLASS_PLACEHOLDER_TEMPLATE (anode))
2791 {
2792 type = do_auto_deduction (type, compound_literal, anode, complain,
2793 adc_variable_type)
and for A() in build_functional_cast, but there we always give error if there
are no parameters. That is wrong because even though there are no arguments
to deduce from, we might still be able to deduce from default template
arguments as in the test. Fixed thus; I'm passing tf_none if there are no
params because we don't want to give redundant diagnostics if the deduction
fails.
OK.
Jason