X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=gcc%2Fcp%2Fpt.c;h=383f0d6d557bf4e6825e74241fe8fa217b426db4;hp=c96b3334fcebac09ab541c627096cd5059968cc4;hb=3848de0c8101dfb3ea8bbe7e26ea92d9fb2f1fec;hpb=026e7813041561e6259e726b43cec17cc7d952e7 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c96b3334fce..383f0d6d557 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1860,6 +1860,7 @@ determine_specialization (tree template_id, { tree decl_arg_types; tree fn_arg_types; + tree insttype; /* In case of explicit specialization, we need to check if the number of template headers appearing in the specialization @@ -1927,7 +1928,8 @@ determine_specialization (tree template_id, template <> void f(); The specialization f is invalid but is not caught by get_bindings below. */ - if (list_length (fn_arg_types) != list_length (decl_arg_types)) + if (cxx_dialect < cxx11 + && list_length (fn_arg_types) != list_length (decl_arg_types)) continue; /* Function templates cannot be specializations; there are @@ -1950,6 +1952,18 @@ determine_specialization (tree template_id, specialize TMPL will produce DECL. */ continue; + if (cxx_dialect >= cxx11) + { + /* Make sure that the deduced arguments actually work. */ + insttype = tsubst (TREE_TYPE (fn), targs, tf_none, NULL_TREE); + if (insttype == error_mark_node) + continue; + fn_arg_types + = skip_artificial_parms_for (fn, TYPE_ARG_TYPES (insttype)); + if (!compparms (fn_arg_types, decl_arg_types)) + continue; + } + /* Save this template, and the arguments deduced. */ templates = tree_cons (targs, fn, templates); }