diff options
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/pt.c | 8 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 17 |
2 files changed, 7 insertions, 18 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 6b63edd..106dfe5 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -29305,10 +29305,10 @@ do_class_deduction (tree ptype, tree tmpl, tree init, } else if (cxx_dialect < cxx20 && DECL_ALIAS_TEMPLATE_P (tmpl)) { - /* This doesn't affect conforming C++17 code, so just pedwarn. */ - if (complain & tf_warning_or_error) - pedwarn (input_location, 0, "alias template deduction only available " - "with %<-std=c++20%> or %<-std=gnu++20%>"); + if (complain & tf_error) + error ("alias template deduction only available " + "with %<-std=c++20%> or %<-std=gnu++20%>"); + return error_mark_node; } tree type = TREE_TYPE (tmpl); diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index a58d397..4e9632f 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -2197,24 +2197,13 @@ build_functional_cast_1 (location_t loc, tree exp, tree parms, error_at (loc, "invalid use of %qT", anode); return error_mark_node; } - else if (!parms) + else { - /* Even if there are no parameters, we might be able to deduce from - default template arguments. Pass TF_NONE so that we don't - generate redundant diagnostics. */ - type = do_auto_deduction (type, parms, anode, tf_none, + type = do_auto_deduction (type, parms, anode, complain, adc_variable_type); if (type == error_mark_node) - { - if (complain & tf_error) - error_at (loc, "cannot deduce template arguments " - "for %qT from %<()%>", anode); - return error_mark_node; - } + return error_mark_node; } - else - type = do_auto_deduction (type, parms, anode, complain, - adc_variable_type); } if (processing_template_decl) |