Hi,
On 13/01/2017 15:51, Nathan Sidwell wrote:
On 01/13/2017 09:45 AM, Paolo Carlini wrote:
Hi,
in this error recovery issue get_underlying_template crashes when
TYPE_TEMPLATE_INFO_MAYBE_ALIAS is applied to a null orig_type. Simply
checking for that condition appears to solve the issue in a
straightforward way. Tested x86_64-linux.
Wouldn't it be better if a scrogged alias got error_mark_node as the
underlying type? (I have no idea whether that's an easy thing to
accomplish)
Your reply, Nathan, led me to investigate where exactly
DECL_ORIGINAL_TYPE becomes null, and turns out that in tsubst_decl we
have code actively doing that. That same code, a few lines below, only
sets TYPE_DEPENDENT_P_VALID to false if type != error_mark_node. I
cannot say to fully understand yet all the details, but certainly the
patchlet below also passes testing. Do you have comments about this too?
Thanks!
Paolo.
///////////////////
Index: pt.c
===================================================================
--- pt.c (revision 244405)
+++ pt.c (working copy)
@@ -12868,7 +12868,8 @@ tsubst_decl (tree t, tree args, tsubst_flags_t com
/* Preserve a typedef that names a type. */
if (is_typedef_decl (r))
{
- DECL_ORIGINAL_TYPE (r) = NULL_TREE;
+ if (type != error_mark_node)
+ DECL_ORIGINAL_TYPE (r) = NULL_TREE;
set_underlying_type (r);
if (TYPE_DECL_ALIAS_P (r) && type != error_mark_node)
/* An alias template specialization can be dependent