re PR c++/79091 (ICE in write_unnamed_type)

PR c++/79091
	* mangle.c (write_exception_spec): Check nothrow explicitly.
	(write_encoding): Don't increment processing_template_decl around
	encoding.

	PR c++/79091
	* g++.dg/pr79091.C: New.

From-SVN: r244575
This commit is contained in:
Nathan Sidwell 2017-01-18 12:51:28 +00:00 committed by Nathan Sidwell
parent 928bff1905
commit 2c65d990eb
4 changed files with 43 additions and 8 deletions

View File

@ -1,3 +1,10 @@
2017-01-18 Nathan Sidwell <nathan@acm.org>
PR c++/79091
* mangle.c (write_exception_spec): Check nothrow explicitly.
(write_encoding): Don't increment processing_template_decl around
encoding.
2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
PR c++/70182

View File

@ -366,17 +366,19 @@ write_exception_spec (tree spec)
return;
}
if (nothrow_spec_p (spec))
if (spec == noexcept_true_spec || spec == empty_except_spec)
write_string ("Do");
else if (TREE_PURPOSE (spec))
else if (tree expr = TREE_PURPOSE (spec))
{
gcc_assert (uses_template_parms (TREE_PURPOSE (spec)));
/* noexcept (expr) */
gcc_assert (uses_template_parms (expr));
write_string ("DO");
write_expression (TREE_PURPOSE (spec));
write_expression (expr);
write_char ('E');
}
else
{
/* throw (type-list) */
write_string ("Dw");
for (tree t = spec; t; t = TREE_CHAIN (t))
write_type (TREE_VALUE (t));
@ -829,7 +831,6 @@ write_encoding (const tree decl)
if (tmpl)
{
++processing_template_decl;
fn_type = get_mostly_instantiated_function_type (decl);
/* FN_TYPE will not have parameter types for in-charge or
VTT parameters. Therefore, we pass NULL_TREE to
@ -846,9 +847,6 @@ write_encoding (const tree decl)
write_bare_function_type (fn_type,
mangle_return_type_p (decl),
d);
if (tmpl)
--processing_template_decl;
}
}

View File

@ -1,3 +1,8 @@
2017-01-18 Nathan Sidwell <nathan@acm.org>
PR c++/79091
* g++.dg/pr79091.C: New.
2017-01-17 Joe Seymour <joe.s@somniumtech.com>
* gcc.target/msp430/mul_f5_muldef.c: New test.

View File

@ -0,0 +1,25 @@
// PR 79091 ICE mangling an unnamed enum in a tempate instantiation.
enum {
One = 1
};
template<int Options>
class Matrix {};
template<int Dim>
Matrix<Dim ? One : 0> *Bar ()
{
return 0;
}
template<int Opt>
Matrix<Opt> *Baz ()
{
return 0;
}
bool Foo ()
{
return Baz<1> () == Bar<1> ();
}