From: Paolo Carlini Date: Thu, 29 Oct 2015 13:12:45 +0000 (+0000) Subject: re PR c++/67845 (ICE on invalid use of const qualifier on x86_64-linux-gnu in merge_t... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f58b8cd70ec2c2a6affed7de996d266998352322;p=gcc.git re PR c++/67845 (ICE on invalid use of const qualifier on x86_64-linux-gnu in merge_types, at cp/typeck.c:854) /cp 2015-10-29 Paolo Carlini PR c++/67845 * decl.c (grokfndecl): In case of erroneous cv-qualified non-member functions consistently reset TREE_TYPE (decl) too. /testsuite 2015-10-29 Paolo Carlini PR c++/67845 * g++.dg/other/cv_func4.C: New. From-SVN: r229523 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d4c9a4f613d..a85166b757d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2015-10-29 Paolo Carlini + + PR c++/67845 + * decl.c (grokfndecl): In case of erroneous cv-qualified non-member + functions consistently reset TREE_TYPE (decl) too. + 2015-10-28 Jason Merrill DR 1518 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 2fb923f11bf..c5ceb5a2d6f 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -7998,6 +7998,11 @@ grokfndecl (tree ctype, DECL_EXTERNAL (decl) = 1; if (TREE_CODE (type) == FUNCTION_TYPE) { + if (quals || rqual) + TREE_TYPE (decl) = apply_memfn_quals (TREE_TYPE (decl), + TYPE_UNQUALIFIED, + REF_QUAL_NONE); + if (quals) { error (ctype diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8c3f4ade88c..77a736fe064 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-10-29 Paolo Carlini + + PR c++/67845 + * g++.dg/other/cv_func4.C: New. + 2015-10-29 Richard Biener PR middle-end/56956 diff --git a/gcc/testsuite/g++.dg/other/cv_func4.C b/gcc/testsuite/g++.dg/other/cv_func4.C new file mode 100644 index 00000000000..df4f19eb51a --- /dev/null +++ b/gcc/testsuite/g++.dg/other/cv_func4.C @@ -0,0 +1,6 @@ +// PR c++/67845 + +typedef void F () const; + +F foo; // { dg-error "cv-qualifier" } +void foo ();