aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <doug.gregor@gmail.com>2007-03-28 12:31:37 +0000
committerDoug Gregor <dgregor@gcc.gnu.org>2007-03-28 12:31:37 +0000
commit771026dd0ccaad37e4af85be52f6bc15a47da194 (patch)
treeef14ed66fcc9bf60ceb65618d216f1c72fa7413e
parent27a0ce7d429e72c249e8cadd47bbfba127ea1b98 (diff)
downloadgcc-771026dd0ccaad37e4af85be52f6bc15a47da194.zip
gcc-771026dd0ccaad37e4af85be52f6bc15a47da194.tar.gz
gcc-771026dd0ccaad37e4af85be52f6bc15a47da194.tar.bz2
[multiple changes]
2007-03-28 Douglas Gregor <doug.gregor@gmail.com> PR c++/29993 * decl.c (grokdeclarator): Deal with cv-qualified function type typedefs in the same way for member and non-member functions. 2007-03-28 Douglas Gregor <doug.gregor@gmail.com> PR c++/29993 * g++.dg/other/cv_func2.C: New. From-SVN: r123294
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c12
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/other/cv_func2.C18
4 files changed, 36 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 13104a2..7541770 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2007-03-28 Douglas Gregor <doug.gregor@gmail.com>
+
+ PR c++/29993
+ * decl.c (grokdeclarator): Deal with cv-qualified function type
+ typedefs in the same way for member and non-member functions.
+
2007-03-26 Dirk Mueller <dmueller@suse.de>
* parser.c (cp_parser_member_declaration): Pedwarn
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index eefbba3..f107bee 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -8029,7 +8029,12 @@ grokdeclarator (const cp_declarator *declarator,
member function of S. We record the cv-qualification in the
function type. */
if (memfn_quals && TREE_CODE (type) == FUNCTION_TYPE)
- type = cp_build_qualified_type (type, memfn_quals);
+ {
+ type = cp_build_qualified_type (type, memfn_quals);
+
+ /* We have now dealt with these qualifiers. */
+ memfn_quals = TYPE_UNQUALIFIED;
+ }
if (decl_context == FIELD)
decl = build_lang_decl (TYPE_DECL, unqualified_id, type);
@@ -8091,11 +8096,6 @@ grokdeclarator (const cp_declarator *declarator,
type with external linkage have external linkage. */
}
- /* Any qualifiers on a function type typedef have already been
- dealt with. */
- if (memfn_quals && !ctype && TREE_CODE (type) == FUNCTION_TYPE)
- memfn_quals = TYPE_UNQUALIFIED;
-
if (signed_p
|| (typedef_decl && C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl)))
C_TYPEDEF_EXPLICITLY_SIGNED (decl) = 1;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5457dfe..442ea61 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2007-03-28 Douglas Gregor <doug.gregor@gmail.com>
+
+
+ PR c++/29993
+ * g++.dg/other/cv_func2.C: New.
+
2007-03-27 Janis Johnson <janis187@us.ibm.com>
* gcc.dg/dfp/func-vararg-alternate.h: New file.
diff --git a/gcc/testsuite/g++.dg/other/cv_func2.C b/gcc/testsuite/g++.dg/other/cv_func2.C
new file mode 100644
index 0000000..ffd249f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/cv_func2.C
@@ -0,0 +1,18 @@
+typedef int ptr1() const; // no error
+
+void foo ()
+{
+ typedef int ptr2() const; // no error
+}
+
+class C
+{
+ typedef int ptr3() const; // error
+
+ void bar ()
+ {
+ typedef int ptr4() const; // no error
+ }
+};
+
+void wibble () const { } // { dg-error "non-member function" }