Bug 28738 - [4.2 regression] ICE specializing invalid template class
Summary: [4.2 regression] ICE specializing invalid template class
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P4 minor
Target Milestone: 4.2.0
Assignee: Lee Millward
URL:
Keywords: error-recovery, ice-on-invalid-code, monitored
Depends on:
Blocks: 27668
  Show dependency treegraph
 
Reported: 2006-08-15 18:45 UTC by Volker Reichelt
Modified: 2006-08-26 17:42 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-08-15 20:44:34


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2006-08-15 18:45:45 UTC
The following invalid testcase triggers an ICE on mainline:

=========================================
template<int,void> struct A {};

template<int N> struct A<N,0> {};
=========================================

bug.cc:1: error: 'void' is not a valid type for a template constant parameter
bug.cc:3: error: partial specialization 'A<N, <expression error> >' does not specialize any template arguments
bug.cc:3: internal compiler error: tree check: expected tree_list, have error_mark in process_partial_specialization, at cp/pt.c:2737
Please submit a full bug report, [etc.]

The ICE happens in the same function as PR 28737, but in a different position.

This is probably fallout from PR 27668.
Comment 1 Lee Millward 2006-08-15 20:44:34 UTC
Confirmed. I'll take a look at it.
Comment 2 Lee Millward 2006-08-26 17:41:33 UTC
Subject: Bug 28738

Author: lmillward
Date: Sat Aug 26 17:41:18 2006
New Revision: 116473

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116473
Log:
        PR c++/28736
        PR c++/28737
        PR c++/28738
        * pt.c (process_template_parm): Store invalid template
        parameters as a TREE_LIST with a TREE_VALUE of error_mark_node.
        (push_inline_template_parms_recursive): Check for template
        parameters having a TREE_VALUE of error_mark_node rather than
        check the parameter itself.
        (mangle_class_name_for_template): Likewise.
        (comp_template_parms): When comparing the individual template
        parameters, return 1 if either is error_mark_node.
        (current_template_args): Robustify.
        (redeclare_class_template): Likewise.

        * g++.dg/template/void10.C: New test.
        * g++.dg/template/void8.C: New test.
        * g++.dg/template/void9.C: New test.

        * g++.dg/template/void3.C: Adjust error markers.
        * g++.dg/template/void4.C: Likewise.
        * g++.dg/template/crash55.C: Likewise.
        * g++.dg/template/void7.C: Likewise.


Added:
    trunk/gcc/testsuite/g++.dg/template/void10.C
    trunk/gcc/testsuite/g++.dg/template/void8.C
    trunk/gcc/testsuite/g++.dg/template/void9.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/template/crash55.C
    trunk/gcc/testsuite/g++.dg/template/void3.C
    trunk/gcc/testsuite/g++.dg/template/void4.C
    trunk/gcc/testsuite/g++.dg/template/void7.C

Comment 3 Lee Millward 2006-08-26 17:42:58 UTC
Fixed on mainline.