Bug 48166 - [4.6/4.7 Regression] ICE on static member function with invalid type qualifier
Summary: [4.6/4.7 Regression] ICE on static member function with invalid type qualifier
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.6.0
: P2 normal
Target Milestone: 4.6.1
Assignee: Jason Merrill
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2011-03-17 12:41 UTC by Martin Kronbichler
Modified: 2011-03-29 16:08 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.5.2
Known to fail: 4.6.0
Last reconfirmed: 2011-03-17 13:13:26


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Kronbichler 2011-03-17 12:41:11 UTC
Using gcc version 4.6.0 20110317 (svn revision 171087) on x86-64 Linux with the code

struct foo {
  static void func ();
};
void foo::func () const {};

and compile line "g++ -c test_static.cc" gives the following:

test_static.cc:4:19: internal compiler error: in merge_types, at cp/typeck.c:825
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

The code is clearly invalid (g++ 4.5 indeed gives the following error message: "test_static.cc:4:19: error: static member function ‘void foo::func()’ declared with type qualifiers"), but g++ 4.6 returns with an ICE.
Comment 1 Jonathan Wakely 2011-03-17 13:13:26 UTC
confirmed as a regression
Comment 2 Richard Biener 2011-03-17 13:28:30 UTC
Confirmed.
Comment 3 Jakub Jelinek 2011-03-17 13:31:04 UTC
Caused by http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159598
Comment 4 Jason Merrill 2011-03-17 16:02:18 UTC
Author: jason
Date: Thu Mar 17 16:02:08 2011
New Revision: 171103

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171103
Log:
	PR c++/48166
	* decl.c (revert_static_member_fn): Strip function-cv-quals.

Added:
    trunk/gcc/testsuite/g++.dg/parse/memfnquals1.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/testsuite/ChangeLog
Comment 5 Jakub Jelinek 2011-03-25 19:51:56 UTC
GCC 4.6.0 is being released, adjusting target milestone.
Comment 6 Jason Merrill 2011-03-29 16:07:20 UTC
Author: jason
Date: Tue Mar 29 16:07:15 2011
New Revision: 171679

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171679
Log:
	PR c++/48166
	* decl.c (revert_static_member_fn): Strip function-cv-quals.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/parse/memfnquals1.C
Modified:
    branches/gcc-4_6-branch/gcc/cp/ChangeLog
    branches/gcc-4_6-branch/gcc/cp/decl.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Comment 7 Jason Merrill 2011-03-29 16:08:33 UTC
Fixed for 4.6.1.