Bug 28860 - [4.0/4.1/4.2 regression] Trouble with bound template template parameter in specialization
Summary: [4.0/4.1/4.2 regression] Trouble with bound template template parameter in sp...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: 4.0.4
Assignee: Volker Reichelt
URL:
Keywords: accepts-invalid, ice-on-invalid-code, monitored
Depends on:
Blocks:
 
Reported: 2006-08-26 21:47 UTC by Volker Reichelt
Modified: 2006-08-28 23:13 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2006-08-26 21:47:58 UTC
The compiler ICEs on the following invalid code snippet since GCC 3.0:

===================================================
template<template<int> class A> class A<0> {};
===================================================

bug.cc:1: internal compiler error: tree check: expected record_type or union_type or qual_union_type, have bound_template_template_parm in xref_basetypes, at cp/decl.c:9788
Please submit a full bug report, [etc.]

In addition the compiler accepts the following similar invalid code snippet:

===================================================
template<template<int> class A> class A<0>;
===================================================

Posting a patch soon.
Comment 1 patchapp@dberlin.org 2006-08-26 22:46:43 UTC
Subject: Bug number PR c++/28860

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-08/msg01014.html
Comment 2 Volker Reichelt 2006-08-28 22:35:01 UTC
Subject: Bug 28860

Author: reichelt
Date: Mon Aug 28 22:34:55 2006
New Revision: 116541

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116541
Log:
	PR c++/28860
	* cp-tree.h (maybe_process_partial_specialization): Return
	tree instead of void.
	* parser.c (cp_parser_class_head): Use return value of
	maybe_process_partial_specialization.
	* pt.c (maybe_process_partial_specialization): Return error_mark_node
	for broken specializations, TYPE otherwise.  Check for template
	template parameters.

	* g++.dg/template/ttp22.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/template/ttp22.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 Volker Reichelt 2006-08-28 22:51:22 UTC
Subject: Bug 28860

Author: reichelt
Date: Mon Aug 28 22:51:17 2006
New Revision: 116543

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116543
Log:
	PR c++/28860
	* cp-tree.h (maybe_process_partial_specialization): Return
	tree instead of void.
	* parser.c (cp_parser_class_head): Use return value of
	maybe_process_partial_specialization.
	* pt.c (maybe_process_partial_specialization): Return error_mark_node
	for broken specializations, TYPE otherwise.  Check for template
	template parameters.

	* g++.dg/template/ttp22.C: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/ttp22.C
Modified:
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/cp-tree.h
    branches/gcc-4_1-branch/gcc/cp/parser.c
    branches/gcc-4_1-branch/gcc/cp/pt.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 4 Volker Reichelt 2006-08-28 23:12:37 UTC
Subject: Bug 28860

Author: reichelt
Date: Mon Aug 28 23:12:32 2006
New Revision: 116544

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116544
Log:
	PR c++/28860
	* cp-tree.h (maybe_process_partial_specialization): Return
	tree instead of void.
	* parser.c (cp_parser_class_head): Use return value of
	maybe_process_partial_specialization.
	* pt.c (maybe_process_partial_specialization): Return error_mark_node
	for broken specializations, TYPE otherwise.  Check for template
	template parameters.

	* g++.dg/template/ttp22.C: New test.

Added:
    branches/gcc-4_0-branch/gcc/testsuite/g++.dg/template/ttp22.C
Modified:
    branches/gcc-4_0-branch/gcc/cp/ChangeLog
    branches/gcc-4_0-branch/gcc/cp/cp-tree.h
    branches/gcc-4_0-branch/gcc/cp/parser.c
    branches/gcc-4_0-branch/gcc/cp/pt.c
    branches/gcc-4_0-branch/gcc/testsuite/ChangeLog

Comment 5 Volker Reichelt 2006-08-28 23:13:51 UTC
Fixed on mainline, 4.1 branch, and 4.0 branch.