[C++ PATCH] c++/78776 fix alias template ICE

Nathan Sidwell nathan@acm.org
Mon Dec 12 19:12:00 GMT 2016

This patch fixes an ICE in a checking build where structural_comptypes 
disagrees with TYPE_CANONICAL.

An (implicit) template alias has a different TYPE_TI_TEMPLATE to the 
thing its aliasing.  That make structural comparison think it's 
different.  In the testcase we end up thinking 'Loc' refers to a 
different template than 'Traits<T>'

Solved by breaking TYPE_TEMPLATE_INFO into an underlying helper that 
doesn't deal with type aliases.  While there, I noticed 
TYPE_TEMPLATE_INFO was doing more work than necessary because it checked 
twice whether DECL_LANG_SPECIFIC (TYPE_NAME (NODE)) was non-null. 
There's no need to check it again in the branch we can only get to when 
it's non-null.  I also removed some unnecessary parens.


Nathan Sidwell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: using-78776.diff
Type: text/x-patch
Size: 4011 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20161212/b0bab603/attachment.bin>

More information about the Gcc-patches mailing list