[Bug c++/85977] Incorrect handling of array reference size deduction
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed May 30 20:50:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85977
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
And a patch that seems to work:
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -21398,6 +21398,16 @@ unify (tree tparms, tree targs, tree parm, tree arg,
int strict,
if (!BRACE_ENCLOSED_INITIALIZER_P (elt))
{
+ /* [over.ics.list]/6 says we should try an implicit conversion
+ from each list element to the corresponding array element
+ type. */
+ if (TREE_CODE (parm) == ARRAY_TYPE)
+ {
+ tree x = perform_implicit_conversion (elttype, elt, complain);
+ if (x != error_mark_node)
+ elt = x;
+ }
+
tree type = TREE_TYPE (elt);
if (type == error_mark_node)
return unify_invalid (explain_p);
More information about the Gcc-bugs
mailing list