[PATCH] Fix PR c++/38646: ICE with invalid specialization of variadic template

Simon Martin simartin@users.sourceforge.net
Sun Nov 15 23:59:00 GMT 2009


Hello,

The following invalid snippet causes an ICE with checking turned on:

=== cut ===
template<int...> struct A;

template<int... N> struct A<N..., N...>
{
       template<typename> struct B;

       template<typename T> struct B<T*> {};
};
=== cut ===

The problem is that the first "N..." in the specialization is turned
into error_mark_node due to its invalid position, which causes a
"checking ICE" (unexpected error_mark_node) in template_class_depth.

The attached patch fixes this by not turning parameter pack arguments
into error_mark_node when they're not at the end of the parameter list.
It also splits a too long line into two.

I have successfully regtested this on x86_64-apple-darwin-9. Is it OK
for trunk?

Best regards,
       Simon

:ADDPATCH c++:




-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_38646
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20091115/84f624df/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pr38646.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20091115/84f624df/attachment-0001.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_38646_testsuite
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20091115/84f624df/attachment-0002.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pr38646.C
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20091115/84f624df/attachment-0003.ksh>


More information about the Gcc-patches mailing list