diff options
author | Jason Merrill <jason@redhat.com> | 2013-04-22 16:35:58 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2013-04-22 16:35:58 -0400 |
commit | 80f7a782fd5a8030805a56db68c85db3bd139e23 (patch) | |
tree | aa9b5669ab9a21f24f5d9a49ab89e7e53ab05db0 /gcc/cp | |
parent | af580858ea4338535dfb2ae4a28cbda18d1b50d0 (diff) | |
download | gcc-80f7a782fd5a8030805a56db68c85db3bd139e23.zip gcc-80f7a782fd5a8030805a56db68c85db3bd139e23.tar.gz gcc-80f7a782fd5a8030805a56db68c85db3bd139e23.tar.bz2 |
re PR c++/48665 (type of const member function)
PR c++/48665
* rtti.c (get_typeid): Diagnose qualified function type.
* pt.c (tsubst) [POINTER_TYPE]: Likewise.
From-SVN: r198160
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/pt.c | 15 | ||||
-rw-r--r-- | gcc/cp/rtti.c | 10 |
3 files changed, 29 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c91f3ec..cb27315 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2013-04-22 Jason Merrill <jason@redhat.com> + PR c++/48665 + * rtti.c (get_typeid): Diagnose qualified function type. + * pt.c (tsubst) [POINTER_TYPE]: Likewise. + * error.c (dump_aggr_type): Fix lambda detection. (dump_simple_decl): Pretty-print capture field. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 77329a4..6ce2770 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -11521,6 +11521,21 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) return error_mark_node; } + else if (TREE_CODE (type) == FUNCTION_TYPE + && (type_memfn_quals (type) != TYPE_UNQUALIFIED + || type_memfn_rqual (type) != REF_QUAL_NONE)) + { + if (complain & tf_error) + { + if (code == POINTER_TYPE) + error ("forming pointer to qualified function type %qT", + type); + else + error ("forming reference to qualified function type %qT", + type); + } + return error_mark_node; + } else if (code == POINTER_TYPE) { r = build_pointer_type (type); diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index b3c6687..4e73165 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -477,6 +477,16 @@ get_typeid (tree type, tsubst_flags_t complain) referenced type. */ type = non_reference (type); + /* This is not one of the uses of a qualified function type in 8.3.5. */ + if (TREE_CODE (type) == FUNCTION_TYPE + && (type_memfn_quals (type) != TYPE_UNQUALIFIED + || type_memfn_rqual (type) != REF_QUAL_NONE)) + { + if (complain & tf_error) + error ("typeid of qualified function type %qT", type); + return error_mark_node; + } + /* The top-level cv-qualifiers of the lvalue expression or the type-id that is the operand of typeid are always ignored. */ type = TYPE_MAIN_VARIANT (type); |