Commit 9a453da5 by Patrick Palka

c++: zero_init_expr_p of dependent expression

This fixes an ICE coming from mangle.c:write_expression when building the
testsuite of range-v3; the added testcase is a reduced reproducer for the ICE.

gcc/cp/ChangeLog:

	* tree.c (zero_init_expr_p): Use uses_template_parms instead of
	dependent_type_p.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/dependent3.C: New test.
parent f9f16625
2020-04-23 Patrick Palka <ppalka@redhat.com>
* tree.c (zero_init_expr_p): Use uses_template_parms instead of
dependent_type_p.
PR c++/94645
* pt.c (template_class_depth): Walk into the DECL_FRIEND_CONTEXT of a
friend declaration rather than into its CP_DECL_CONTEXT.
......
......@@ -4486,7 +4486,7 @@ bool
zero_init_expr_p (tree t)
{
tree type = TREE_TYPE (t);
if (!type || dependent_type_p (type))
if (!type || uses_template_parms (type))
return false;
if (zero_init_p (type))
return initializer_zerop (t);
......
2020-04-23 Patrick Palka <ppalka@redhat.com>
* g++.dg/cpp0x/dependent3.C: New test.
PR c++/94645
* g++.dg/cpp2a/concepts-lambda6.C: New test.
......
// { dg-do compile { target c++11 } }
template<typename c>
struct d
{
using e = c;
};
template<class f>
struct g
{
using h = typename d<f>::e;
template<class i, class j>
auto operator()(i, j k) -> decltype(h{k});
};
template<class l>
void m()
{
int a[1];
l{}(a, a);
}
int main()
{
m<g<int *>>();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment