diff options
author | Paolo Carlini <paolo@gcc.gnu.org> | 2013-11-25 16:10:29 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2013-11-25 16:10:29 +0000 |
commit | 6f640d1576d109cb13898a449fa84619e7a50ad4 (patch) | |
tree | 3f0f6551c76f559bd6e55ffe94a919e04ae6bbd9 | |
parent | 80e87457803f7c77ced5ff80f86b146f53625e65 (diff) | |
download | gcc-6f640d1576d109cb13898a449fa84619e7a50ad4.zip gcc-6f640d1576d109cb13898a449fa84619e7a50ad4.tar.gz gcc-6f640d1576d109cb13898a449fa84619e7a50ad4.tar.bz2 |
re PR c++/58810 (ICE with invalid function typedef)
/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
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl.c | 15 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/cv_func.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/cv_func3.C | 10 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/fn-typedef2.C | 2 |
6 files changed, 28 insertions, 20 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 74b75e9..8118471 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,11 @@ 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 * pt.c (unify): Don't call unify_array_domain with a NULL_TREE third argument. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 889c203..75e29f4 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c0bd2b1..50e72f4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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> diff --git a/gcc/testsuite/g++.dg/other/cv_func.C b/gcc/testsuite/g++.dg/other/cv_func.C index 941cb8d..2eb9f03 100644 --- a/gcc/testsuite/g++.dg/other/cv_func.C +++ b/gcc/testsuite/g++.dg/other/cv_func.C @@ -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 index 0000000..0fd4788 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/cv_func3.C @@ -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" } +}; diff --git a/gcc/testsuite/g++.dg/parse/fn-typedef2.C b/gcc/testsuite/g++.dg/parse/fn-typedef2.C index c9c7f06..6bb8302 100644 --- a/gcc/testsuite/g++.dg/parse/fn-typedef2.C +++ b/gcc/testsuite/g++.dg/parse/fn-typedef2.C @@ -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" } |