diff options
author | Jason Merrill <jason@redhat.com> | 2009-11-06 16:18:35 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2009-11-06 16:18:35 -0500 |
commit | 3c3905fc17fbaad4a0a3753fb166161154119e0b (patch) | |
tree | f9094fc4cf47ff01a50904d19522921bff716411 /gcc/cp/decl.c | |
parent | 7ac8318c2daf09b9f2e1612b3add3584f58ac3b7 (diff) | |
download | gcc-3c3905fc17fbaad4a0a3753fb166161154119e0b.zip gcc-3c3905fc17fbaad4a0a3753fb166161154119e0b.tar.gz gcc-3c3905fc17fbaad4a0a3753fb166161154119e0b.tar.bz2 |
re PR c++/9381 (attribute on member function pointer have no effect)
PR c++/9381
* decl2.c (build_memfn_type): Preserve attributes.
(cp_reconstruct_complex_type): Likewise.
(maybe_retrofit_in_chrg): Likewise.
* call.c (standard_conversion): Use build_memfn_type.
* pt.c (tsubst): Likewise.
* decl.c (build_ptrmem_type): Likewise
(check_function_type): Preserve attributes.
* tree.c (cp_build_type_attribute_variant): Propagate exception
specs on METHOD_TYPE, too.
(strip_typedefs): Preserve exception specs and attributes.
From-SVN: r153977
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 97f1ac1f..5e2f85f 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -7170,16 +7170,9 @@ build_ptrmem_type (tree class_type, tree member_type) { if (TREE_CODE (member_type) == METHOD_TYPE) { - tree arg_types; - - arg_types = TYPE_ARG_TYPES (member_type); - class_type = (cp_build_qualified_type - (class_type, - cp_type_quals (TREE_TYPE (TREE_VALUE (arg_types))))); - member_type - = build_method_type_directly (class_type, - TREE_TYPE (member_type), - TREE_CHAIN (arg_types)); + tree arg_types = TYPE_ARG_TYPES (member_type); + cp_cv_quals quals = cp_type_quals (TREE_TYPE (TREE_VALUE (arg_types))); + member_type = build_memfn_type (member_type, class_type, quals); return build_ptrmemfunc_type (build_pointer_type (member_type)); } else @@ -11551,7 +11544,7 @@ lookup_enumerator (tree enumtype, tree name) } -/* We're defining DECL. Make sure that it's type is OK. */ +/* We're defining DECL. Make sure that its type is OK. */ static void check_function_type (tree decl, tree current_function_parms) @@ -11585,9 +11578,12 @@ check_function_type (tree decl, tree current_function_parms) TREE_CHAIN (args)); else fntype = build_function_type (void_type_node, args); - TREE_TYPE (decl) + fntype = build_exception_variant (fntype, TYPE_RAISES_EXCEPTIONS (TREE_TYPE (decl))); + fntype = (cp_build_type_attribute_variant + (fntype, TYPE_ATTRIBUTES (TREE_TYPE (decl)))); + TREE_TYPE (decl) = fntype; } else abstract_virtuals_error (decl, TREE_TYPE (fntype)); |