re PR c++/67845 (ICE on invalid use of const qualifier on x86_64-linux-gnu in merge_t...
authorPaolo Carlini <paolo.carlini@oracle.com>
Thu, 29 Oct 2015 13:12:45 +0000 (13:12 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 29 Oct 2015 13:12:45 +0000 (13:12 +0000)
/cp
2015-10-29  Paolo Carlini  <paolo.carlini@oracle.com>

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  <paolo.carlini@oracle.com>

PR c++/67845
* g++.dg/other/cv_func4.C: New.

From-SVN: r229523

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/cv_func4.C [new file with mode: 0644]

index d4c9a4f613dce2761254656de33b8bab3ce930a7..a85166b757dd619a230ed2cf97ff707220ec6074 100644 (file)
@@ -1,3 +1,9 @@
+2015-10-29  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       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  <jason@redhat.com>
 
        DR 1518
index 2fb923f11bf63e6f78e526296bb6cdeab31f5a08..c5ceb5a2d6f3898395575c62b5ab297ba6696620 100644 (file)
@@ -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
index 8c3f4ade88c9d84819c514307f961bee5072ff2a..77a736fe064028e80ea733627ae61c10fbedd232 100644 (file)
@@ -1,3 +1,8 @@
+2015-10-29  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/67845
+       * g++.dg/other/cv_func4.C: New.
+
 2015-10-29  Richard Biener  <rguenther@suse.de>
 
        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 (file)
index 0000000..df4f19e
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/67845
+
+typedef void F () const;
+
+F foo;  // { dg-error "cv-qualifier" }
+void foo ();