Bug 48707 - [4.6/4.7 Regression] [c++0x] ICE initializing static const int
Summary: [4.6/4.7 Regression] [c++0x] ICE initializing static const int
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: Jason Merrill
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-20 20:16 UTC by Roman Kononov
Modified: 2011-04-25 21:54 UTC (History)
1 user (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
Build: x86_64-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2011-04-25 17:13:33


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Kononov 2011-04-20 20:16:47 UTC
$ cat test.cc 
struct A {
  static int a();
};

template<typename X>
struct B: A {
  static int const b;
};

template<typename X>
int const B<X>::b=B<X>::a();

$ g++ -c -std=c++0x test.cc
test.cc:11:27: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Roman Kononov 2011-04-21 15:57:12 UTC
It is caused by -r170488.
Comment 2 Jason Merrill 2011-04-25 21:51:36 UTC
Author: jason
Date: Mon Apr 25 21:51:33 2011
New Revision: 172941

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172941
Log:
	PR c++/48707
	* decl.c (type_dependent_init_p): New.
	(cp_finish_decl): Check it.
	* pt.c (any_type_dependent_elements_p): New.
	* cp-tree.h: Declare it.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/regress/template-const2.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog
Comment 3 Jason Merrill 2011-04-25 21:54:04 UTC
Author: jason
Date: Mon Apr 25 21:53:57 2011
New Revision: 172942

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172942
Log:
	PR c++/48707
	* pt.c (value_dependent_expression_p): Handle type-dependent
	expression.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/cpp0x/regress/template-const2.C
Modified:
    branches/gcc-4_6-branch/gcc/cp/ChangeLog
    branches/gcc-4_6-branch/gcc/cp/pt.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Comment 4 Jason Merrill 2011-04-25 21:54:31 UTC
Fixed.