aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/tree.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2004-02-02 16:53:17 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2004-02-02 16:53:17 +0000
commite9525111c9a3fabe2244b57e7a6257b708b8f9f5 (patch)
tree18f97563be8180b80b8d845bab5a84a1cb6453c4 /gcc/cp/tree.c
parent7c9201514989cce06b05850f55f3bcd0e3d5e18b (diff)
downloadgcc-e9525111c9a3fabe2244b57e7a6257b708b8f9f5.zip
gcc-e9525111c9a3fabe2244b57e7a6257b708b8f9f5.tar.gz
gcc-e9525111c9a3fabe2244b57e7a6257b708b8f9f5.tar.bz2
re PR c++/13113 (Nice warning about &(X::m) lost)
PR c++/13113 * init.c (build_offset_ref): Improve error recovery for invalid uses of non-static member functions. PR c++/13854 * cp-tree.h (cp_build_type_attribute_variant): New function. * class.c (build_clone): Use cp_build_type_attribute_variant. * decl.c (duplicate_decls): Likewise. * pt.c (copy_default_args_to_explicit_spec): Likewise. (tsubst_function_type): Likewise. * tree.c (build_exception_variant): Check attributes before concluding that two types are the same. (cp_build_type-attribute_variant): New method. * typeck.c (merge_types): Use cp_build_type_attribute_variant. PR c++/13907 * call.c (convert_class_to_reference): Keep better track of pedantically invalid user-defined conversions. PR c++/13113 * g++.old-deja/g++.mike/net36.C: Adjust error messages. PR c++/13854 * g++.dg/ext/attrib13.C: New test. PR c++/13907 * g++.dg/conversion/op2.C: New test. From-SVN: r77127
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r--gcc/cp/tree.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 7d98128..3413ede 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -991,7 +991,8 @@ build_exception_variant (tree type, tree raises)
for (; v; v = TYPE_NEXT_VARIANT (v))
if (TYPE_QUALS (v) == type_quals
- && comp_except_specs (raises, TYPE_RAISES_EXCEPTIONS (v), 1))
+ && comp_except_specs (raises, TYPE_RAISES_EXCEPTIONS (v), 1)
+ && (*targetm.comp_type_attributes) (type, v))
return v;
/* Need to build a new variant. */
@@ -1962,6 +1963,23 @@ make_ptrmem_cst (tree type, tree member)
return ptrmem_cst;
}
+/* Build a variant of TYPE that has the indicated ATTRIBUTES. May
+ return an existing type of an appropriate type already exists. */
+
+tree
+cp_build_type_attribute_variant (tree type, tree attributes)
+{
+ tree new_type;
+
+ new_type = build_type_attribute_variant (type, attributes);
+ if (TREE_CODE (new_type) == FUNCTION_TYPE
+ && (TYPE_RAISES_EXCEPTIONS (new_type)
+ != TYPE_RAISES_EXCEPTIONS (type)))
+ new_type = build_exception_variant (new_type,
+ TYPE_RAISES_EXCEPTIONS (type));
+ return new_type;
+}
+
/* Apply FUNC to all language-specific sub-trees of TP in a pre-order
traversal. Called from walk_tree(). */