aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/other/cv_func4.C6
4 files changed, 22 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d4c9a4f..a85166b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 2fb923f..c5ceb5a 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 8c3f4ad..77a736f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..df4f19e
--- /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 ();