re PR c++/48166 (ICE on static member function with invalid type qualifier)

PR c++/48166
	* decl.c (revert_static_member_fn): Strip function-cv-quals.

From-SVN: r171103
This commit is contained in:
Jason Merrill 2011-03-17 12:02:08 -04:00 committed by Jason Merrill
parent 8054a38972
commit 547206a4e5
4 changed files with 22 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2011-03-17 Jason Merrill <jason@redhat.com>
PR c++/48166
* decl.c (revert_static_member_fn): Strip function-cv-quals.
2011-03-16 Jason Merrill <jason@redhat.com>
PR c++/48089

View File

@ -13344,10 +13344,14 @@ static_fn_type (tree memfntype)
void
revert_static_member_fn (tree decl)
{
TREE_TYPE (decl) = static_fn_type (decl);
tree stype = static_fn_type (decl);
if (cp_type_quals (TREE_TYPE (decl)) != TYPE_UNQUALIFIED)
error ("static member function %q#D declared with type qualifiers", decl);
if (type_memfn_quals (stype) != TYPE_UNQUALIFIED)
{
error ("static member function %q#D declared with type qualifiers", decl);
stype = apply_memfn_quals (stype, TYPE_UNQUALIFIED);
}
TREE_TYPE (decl) = stype;
if (DECL_ARGUMENTS (decl))
DECL_ARGUMENTS (decl) = DECL_CHAIN (DECL_ARGUMENTS (decl));

View File

@ -1,3 +1,7 @@
2011-03-17 Jason Merrill <jason@redhat.com>
* g++.dg/parse/memfnquals1.C: New.
2011-03-17 Richard Guenther <rguenther@suse.de>
PR middle-end/48134

View File

@ -0,0 +1,6 @@
// PR c++/48166
struct foo {
static void func ();
};
void foo::func () const {} // { dg-error "type qualifiers" }