Bug 48280 - [4.5/4.6/4.7 Regression] [C++0x] ICE: tree check: expected var_decl or function_decl, have template_decl in check_bases_and_members, at cp/class.c:4695
Summary: [4.5/4.6/4.7 Regression] [C++0x] ICE: tree check: expected var_decl or functi...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: 4.6.1
Assignee: Not yet assigned to anyone
URL:
Keywords: error-recovery, ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2011-03-24 23:13 UTC by Zdenek Sojka
Modified: 2011-03-31 20:33 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.4.6
Known to fail: 4.5.3, 4.6.0, 4.7.0
Last reconfirmed: 2011-03-25 10:19:40


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2011-03-24 23:13:22 UTC
----- testcase.C -----
struct S {
  template < typename > S (const S &) = default;
};
----------------------

Compiler output:
$ gcc -std=c++0x testcase.C 
testcase.C:2:41: error: 'S::S(const S&)' cannot be defaulted
testcase.C:1:8: internal compiler error: tree check: expected var_decl or function_decl, have template_decl in check_bases_and_members, at cp/class.c:4695
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Tested revisions:
r171399 - crash
4.6 r170955 - crash
4.5 r170955 - crash
4.4 r170955 - OK
Comment 1 Richard Biener 2011-03-25 10:19:40 UTC
Confirmed.
Comment 2 Jason Merrill 2011-03-31 20:29:52 UTC
Author: jason
Date: Thu Mar 31 20:29:49 2011
New Revision: 171797

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171797
Log:
	PR c++/48280
	* method.c (defaultable_fn_check): Templates are not defaultable.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/defaulted24.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/method.c
    trunk/gcc/testsuite/ChangeLog
Comment 3 Jason Merrill 2011-03-31 20:33:10 UTC
Author: jason
Date: Thu Mar 31 20:33:07 2011
New Revision: 171798

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171798
Log:
	PR c++/48280
	* method.c (defaultable_fn_check): Templates are not defaultable.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/cpp0x/defaulted24.C
Modified:
    branches/gcc-4_6-branch/gcc/cp/ChangeLog
    branches/gcc-4_6-branch/gcc/cp/method.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Comment 4 Jason Merrill 2011-03-31 20:33:57 UTC
Fixed for 4.6.1, not backporting to 4.5.