]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/58810 (ICE with invalid function typedef)
authorPaolo Carlini <paolo@gcc.gnu.org>
Mon, 25 Nov 2013 16:10:29 +0000 (16:10 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 25 Nov 2013 16:10:29 +0000 (16:10 +0000)
/cp
2013-11-25  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/58810
* decl.c (grokdeclarator): Don't handle qualified free functions here,
leave the diagnostic to grokfndecl.

/testsuite
2013-11-25  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/58810
* g++.dg/other/cv_func3.C: New.
* g++.dg/other/cv_func.C: Adjust.
* g++.dg/parse/fn-typedef2.C: Likewise.

From-SVN: r205356

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/cv_func.C
gcc/testsuite/g++.dg/other/cv_func3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/parse/fn-typedef2.C

index 74b75e9891c9d9878d0702e15cbc7d5b2d6e5780..8118471f60f4f089cd1a9067754ba9d5b30ac886 100644 (file)
@@ -1,3 +1,9 @@
+2013-11-25  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/58810
+       * decl.c (grokdeclarator): Don't handle qualified free functions here,
+       leave the diagnostic to grokfndecl.
+
 2013-11-25  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/59080
index 889c203b1f18d97977023e41d4118f7e543da8c7..75e29f4bfa229c79589aca438bed96cef0369548 100644 (file)
@@ -10256,21 +10256,6 @@ grokdeclarator (const cp_declarator *declarator,
 
       if (decl_context != TYPENAME)
        {
-         /* A cv-qualifier-seq shall only be part of the function type
-            for a non-static member function. A ref-qualifier shall only
-            .... /same as above/ [dcl.fct] */
-         if ((type_memfn_quals (type) != TYPE_UNQUALIFIED
-              || type_memfn_rqual (type) != REF_QUAL_NONE)
-             && (current_class_type == NULL_TREE || staticp) )
-           {
-             error (staticp
-                     ? G_("qualified function types cannot be used to "
-                          "declare static member functions")
-                     : G_("qualified function types cannot be used to "
-                          "declare free functions"));
-             type = TYPE_MAIN_VARIANT (type);
-           }
-
          /* The qualifiers on the function type become the qualifiers on
             the non-static member function. */
          memfn_quals |= type_memfn_quals (type);
index c0bd2b15d7c511b57ba851df4fb2bb32d2c024d6..50e72f4c8803877700cabc2dd640faacd5177f50 100644 (file)
@@ -1,3 +1,10 @@
+2013-11-25  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/58810
+       * g++.dg/other/cv_func3.C: New.
+       * g++.dg/other/cv_func.C: Adjust.
+       * g++.dg/parse/fn-typedef2.C: Likewise.
+
 2013-11-25  Marek Polacek  <polacek@redhat.com>
 
        PR sanitizer/59250
@@ -20,9 +27,9 @@
 
        PR c++/59112
        PR c++/59113
-       g++.dg/cpp1y/pr58533.C: Updated testcase.
-       g++.dg/cpp1y/pr59112.C: New testcase.
-       g++.dg/cpp1y/pr59113.C: New testcase.
+       g++.dg/cpp1y/pr58533.C: Updated testcase.
+       g++.dg/cpp1y/pr59112.C: New testcase.
+       g++.dg/cpp1y/pr59113.C: New testcase.
 
 2013-11-25  Terry Guo  <terry.guo@arm.com>
 
index 941cb8d53d86cf07b894d2fb6f421e765cd27e03..2eb9f039a5a8cde73c3008d95897ea5fb0308105 100644 (file)
@@ -3,7 +3,7 @@
 typedef int FIC(int) const;
 typedef int FI(int);
 
-FIC f; // { dg-error "qualified" }
+FIC f; // { dg-error "cv-qualifier" }
 struct S {
   FIC f; // OK
 
diff --git a/gcc/testsuite/g++.dg/other/cv_func3.C b/gcc/testsuite/g++.dg/other/cv_func3.C
new file mode 100644 (file)
index 0000000..0fd4788
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/58810
+
+typedef int F() const;
+
+F f;           // { dg-error "cv-qualifier" }
+
+struct A
+{
+  friend F f;  // { dg-error "cv-qualifier" }
+};
index c9c7f060d01f19b5cba0c83c8267b2848a99c2af..6bb83024b9f8ee87ebb949edc43d2801573805ef 100644 (file)
@@ -4,4 +4,4 @@ typedef void ft() const;
 typedef void V;
 typedef V ft() const;
 
-ft f;                          // { dg-error "qualified" }
+ft f;                          // { dg-error "cv-qualifier" }