From: Jason Merrill Date: Thu, 17 Mar 2011 16:02:08 +0000 (-0400) Subject: re PR c++/48166 (ICE on static member function with invalid type qualifier) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=547206a4e530360a06679894c2a9f2168bf5f943;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7248c119e7b..38ac06ce7df 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2011-03-17 Jason Merrill + + PR c++/48166 + * decl.c (revert_static_member_fn): Strip function-cv-quals. + 2011-03-16 Jason Merrill PR c++/48089 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index a7da5742a5e..0985749f32a 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 20ba8d6a6a1..47cdbc920e1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-03-17 Jason Merrill + + * g++.dg/parse/memfnquals1.C: New. + 2011-03-17 Richard Guenther PR middle-end/48134 diff --git a/gcc/testsuite/g++.dg/parse/memfnquals1.C b/gcc/testsuite/g++.dg/parse/memfnquals1.C new file mode 100644 index 00000000000..ce8af7b7273 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/memfnquals1.C @@ -0,0 +1,6 @@ +// PR c++/48166 + +struct foo { + static void func (); +}; +void foo::func () const {} // { dg-error "type qualifiers" }