2011-03-08 Jason Merrill <jason@redhat.com>
+ PR c++/47705
+ * pt.c (convert_nontype_argument): Don't crash on non-pointer
+ argument to pointer parameter.
+
PR c++/45651
* pt.c (instantiate_decl): Don't clear DECL_INTERFACE_KNOWN on
!TREE_PUBLIC decls.
qualification conversion. Let's strip everything. */
else if (TYPE_PTROBV_P (type))
{
- STRIP_NOPS (expr);
- gcc_assert (TREE_CODE (expr) == ADDR_EXPR);
- gcc_assert (TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE);
- /* Skip the ADDR_EXPR only if it is part of the decay for
- an array. Otherwise, it is part of the original argument
- in the source code. */
- if (TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0))) == ARRAY_TYPE)
- expr = TREE_OPERAND (expr, 0);
- expr_type = TREE_TYPE (expr);
+ tree sub = expr;
+ STRIP_NOPS (sub);
+ if (TREE_CODE (sub) == ADDR_EXPR)
+ {
+ gcc_assert (TREE_CODE (TREE_TYPE (sub)) == POINTER_TYPE);
+ /* Skip the ADDR_EXPR only if it is part of the decay for
+ an array. Otherwise, it is part of the original argument
+ in the source code. */
+ if (TREE_CODE (TREE_TYPE (TREE_OPERAND (sub, 0))) == ARRAY_TYPE)
+ expr = TREE_OPERAND (sub, 0);
+ else
+ expr = sub;
+ expr_type = TREE_TYPE (expr);
+ }
}
}
2011-03-08 Jason Merrill <jason@redhat.com>
+ * g++.dg/template/nontype21.C: New.
+
* g++.dg/template/anon5.C: New.
2011-03-08 Jakub Jelinek <jakub@redhat.com>