(add_template_candidate_real): Set it.
(build_over_call): Use it to control init-list warning.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159510
138bc75d-0d04-0410-961f-
82ee72b054a4
2010-05-17 Jason Merrill <jason@redhat.com>
2010-05-17 Jason Merrill <jason@redhat.com>
+ * call.c (struct z_candidate): Add explicit_targs field.
+ (add_template_candidate_real): Set it.
+ (build_over_call): Use it to control init-list warning.
+
PR c++/44157
* call.c (build_over_call): Limit init-list deduction warning to
cases where the argument is actually an init-list.
PR c++/44157
* call.c (build_over_call): Limit init-list deduction warning to
cases where the argument is actually an init-list.
indicated by the CONVERSION_PATH. */
tree conversion_path;
tree template_decl;
indicated by the CONVERSION_PATH. */
tree conversion_path;
tree template_decl;
candidate_warning *warnings;
z_candidate *next;
};
candidate_warning *warnings;
z_candidate *next;
};
cand->template_decl = build_template_info (tmpl, targs);
else
cand->template_decl = DECL_TEMPLATE_INFO (fn);
cand->template_decl = build_template_info (tmpl, targs);
else
cand->template_decl = DECL_TEMPLATE_INFO (fn);
+ cand->explicit_targs = explicit_targs;
pattype = PACK_EXPANSION_PATTERN (pattype);
pattype = non_reference (pattype);
pattype = PACK_EXPANSION_PATTERN (pattype);
pattype = non_reference (pattype);
- if (!is_std_init_list (pattype))
+ if (TREE_CODE (pattype) == TEMPLATE_TYPE_PARM
+ && (cand->explicit_targs == NULL_TREE
+ || (TREE_VEC_LENGTH (cand->explicit_targs)
+ <= TEMPLATE_TYPE_IDX (pattype))))
{
pedwarn (input_location, 0, "deducing %qT as %qT",
non_reference (TREE_TYPE (patparm)),
{
pedwarn (input_location, 0, "deducing %qT as %qT",
non_reference (TREE_TYPE (patparm)),
PR c++/44157
* g++.dg/cpp0x/initlist34.C: New.
PR c++/44157
* g++.dg/cpp0x/initlist34.C: New.
-2010-05-17 Jason Merrill <jason@redhat.com>
-
PR c++/44158
* g++.dg/cpp0x/rv-trivial-bug.C: Test copy-init too.
PR c++/44158
* g++.dg/cpp0x/rv-trivial-bug.C: Test copy-init too.
int main() {
std::initializer_list<int> a = { 0 };
f(a);
int main() {
std::initializer_list<int> a = { 0 };
f(a);
+
+ f<std::initializer_list<int> >({ 0 });