summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-03-29 12:07:15 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-03-29 12:07:15 -0400
commitab630c593369ab1c13bea5072ea8d017768fc75d (patch)
tree6710cbd0162074f0074ffbe898d44835fb1e5eb7 /gcc/cp
parent5a9970d5c5e44898654b3bf9b5d70db1c758d839 (diff)
downloadgcc-ab630c593369ab1c13bea5072ea8d017768fc75d.tar.gz
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: r171679
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/decl.c10
2 files changed, 10 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 62a45f46dcd..cccac51142f 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2011-03-29 Jason Merrill <jason@redhat.com>
+ PR c++/48166
+ * decl.c (revert_static_member_fn): Strip function-cv-quals.
+
PR c++/48296
* decl.c (cp_finish_decl): Defer validation of constexpr member
functions.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index fbd6c9784fd..41beef35a00 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -13342,10 +13342,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));