Bug 35026 - [4.3 regression] ICE with parameter pack in pointer type
Summary: [4.3 regression] ICE with parameter pack in pointer type
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.0
: P5 normal
Target Milestone: 4.3.0
Assignee: dgregor
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: accepts-invalid, error-recovery, ice-on-invalid-code, monitored
Depends on:
Blocks:
 
Reported: 2008-01-30 00:28 UTC by Volker Reichelt
Modified: 2008-02-15 17:35 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-02-14 21:45:58


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2008-01-30 00:28:26 UTC
The following invalid code snippet is accepted on mainline:

=====================================
template<typename... T> struct A
{
  T* x[1];
};

A<int> a;
=====================================

One can also trigger ICEs with the snippet if one compiles it with "-g":

bug.cc: In instantiation of 'A<int>':
bug.cc:6:   instantiated from here
bug.cc:2: internal compiler error: in gen_type_die_with_usage, at dwarf2out.c:13432
Please submit a full bug report, [etc.]

or with "-gstabs":

bug.cc: In instantiation of 'A<int>':
bug.cc:6:   instantiated from here
bug.cc:2: internal compiler error: in dbxout_type, at dbxout.c:2237
Please submit a full bug report, [etc.]
Comment 1 dgregor 2008-02-15 03:52:09 UTC
Patch here: http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00529.html

We could tweak this ice-on-invalid-code to create some ice-on-valid-code failures. See the e-mail with the patch.
Comment 2 dgregor 2008-02-15 17:33:49 UTC
Subject: Bug 35026

Author: dgregor
Date: Fri Feb 15 17:33:02 2008
New Revision: 132348

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132348
Log:
2008-02-15  Douglas Gregor  <doug.gregor@gmail.com>

	PR c++/35023
	PR c++/35024
	PR c++/35026
	* pt.c (finish_member_template_decl): If the type in a TYPE_DECL
	is error_mark_node, return an error early.
	(find_parameter_packs_r): Pass the pointer set along to recursive
	calls of cp_walk_subtrees; don't try to manage the pointer set
	ourselves.
	(uses_parameter_packs): Pass the pointer set to cp_walk_tree.
	(make_pack_expansion): Ditto.
	(check_for_bare_parameter_packs): Ditto. Also, don't bother taking
	a second pass through the tree with find_parameter_packs_r; that
	second pass no longer does anything.
	(push_template_decl_real): If we have an erroneous declaration,
	set its type to error_mark_node before returning an error.

2008-02-15  Douglas Gregor  <doug.gregor@gmail.com>

	PR c++/35023
	PR c++/35024
	PR c++/35026
	* g++.dg/cpp0x/vt-35026.C: New.
	* g++.dg/cpp0x/vt-35023.C: New.
	* g++.dg/cpp0x/vt-34055.C: Tweak expected error messages.
	* g++.dg/cpp0x/vt-35024.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/vt-35023.C
    trunk/gcc/testsuite/g++.dg/cpp0x/vt-35024.C
    trunk/gcc/testsuite/g++.dg/cpp0x/vt-35026.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/cpp0x/vt-34055.C

Comment 3 dgregor 2008-02-15 17:35:42 UTC
Fixed for 4.3