Bug 28736 - [4.2 regression] ICE with friend of invalid template class
Summary: [4.2 regression] ICE with friend of invalid template class
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P4 normal
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:37 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:04


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:37:36 UTC
The following invalid testcase triggers an ICE on mainline:

=========================================
template<void> struct A
{
    template<typename> friend struct B;
};

template<typename> struct B {};

B<int> b;
=========================================

bug.cc:1: error: 'void' is not a valid type for a template constant parameter
bug.cc:3: internal compiler error: tree check: expected var_decl or function_decl or type_decl or template_decl, have error_mark in most_general_template, at cp/pt.c:11253
Please submit a full bug report, [etc.]

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

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:16 UTC
Fixed on mainline.