diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2014-06-24 14:47:42 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2014-06-24 14:47:42 +0000 |
commit | d13073607fee805d1705336f672969e5db89fd2b (patch) | |
tree | 913668dae6855994fde225daea3c4447486f98d7 | |
parent | fb112177481effbbf9db80444a1ad6d0dd9f7757 (diff) | |
download | gcc-d13073607fee805d1705336f672969e5db89fd2b.zip gcc-d13073607fee805d1705336f672969e5db89fd2b.tar.gz gcc-d13073607fee805d1705336f672969e5db89fd2b.tar.bz2 |
re PR c++/33972 (Cannot declare operator() using function typedef)
/cp
2014-06-24 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/33972
* decl.c (grokdeclarator): Do not early check for operator-function-id
as non-function.
/testsuite
2014-06-24 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/33972
* g++.dg/other/operator3.C: New.
* g++.dg/template/operator8.C: Adjust.
* g++.dg/template/operator9.C: Likewise.
From-SVN: r211944
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/operator3.C | 7 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/operator8.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/operator9.C | 2 |
6 files changed, 23 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f2f4e3c..f9f0eab 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2014-06-24 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/33972 + * decl.c (grokdeclarator): Do not early check for operator-function-id + as non-function. + 2014-06-24 Trevor Saunders <tsaunders@mozilla.com> * class.c, semantics.c, tree.c, vtable-class-hierarchy.c: diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index b4d8b94..d548f61 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -9007,7 +9007,7 @@ grokdeclarator (const cp_declarator *declarator, return error_mark_node; } - if (((dname && IDENTIFIER_OPNAME_P (dname)) || flags == TYPENAME_FLAG) + if (flags == TYPENAME_FLAG && innermost_code != cdk_function && ! (ctype && !declspecs->any_specifiers_p)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ade10c7..d42af0f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2014-06-24 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/33972 + * g++.dg/other/operator3.C: New. + * g++.dg/template/operator8.C: Adjust. + * g++.dg/template/operator9.C: Likewise. + 2014-06-24 Alan Lawrence <alan.lawrence@arm.com> * gcc.target/aarch64/singleton_intrinsics_1.c: Save temps and cleanup. diff --git a/gcc/testsuite/g++.dg/other/operator3.C b/gcc/testsuite/g++.dg/other/operator3.C new file mode 100644 index 0000000..5c0968d --- /dev/null +++ b/gcc/testsuite/g++.dg/other/operator3.C @@ -0,0 +1,7 @@ +// PR c++/33972 + +struct s +{ + typedef void f(void); + f operator(); +}; diff --git a/gcc/testsuite/g++.dg/template/operator8.C b/gcc/testsuite/g++.dg/template/operator8.C index 29d17b8..52f2218 100644 --- a/gcc/testsuite/g++.dg/template/operator8.C +++ b/gcc/testsuite/g++.dg/template/operator8.C @@ -2,5 +2,5 @@ struct A { - template<operator+> void foo() {} // { dg-error "identifier|non-function|template arguments" } + template<operator+> void foo() {} // { dg-error "identifier|parameter|template arguments" } }; diff --git a/gcc/testsuite/g++.dg/template/operator9.C b/gcc/testsuite/g++.dg/template/operator9.C index dfd491d..d4ebad3 100644 --- a/gcc/testsuite/g++.dg/template/operator9.C +++ b/gcc/testsuite/g++.dg/template/operator9.C @@ -1,6 +1,6 @@ //PR c++/27670 -template<operator+> void foo(); // { dg-error "before|non-function|template" } +template<operator+> void foo(); // { dg-error "before|parameter|template" } void bar() { |