diff options
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 2 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 7 |
3 files changed, 13 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c275274..e542959 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2013-08-01 Fabien ChĂȘne <fabien@gcc.gnu.org> + + PR c++/54537 + * cp-tree.h: Check OVL_USED with OVERLOAD_CHECK. + * name-lookup.c (do_nonmember_using_decl): Make sure we have an + OVERLOAD before calling OVL_USED. Call diagnose_name_conflict + instead of issuing an error without mentioning the conflicting + declaration. + 2013-07-31 Paolo Carlini <paolo.carlini@oracle.com> * parser.c (cp_parser_sizeof_pack): Check cp_parser_identifier diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 200e78a..859f805 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -346,7 +346,7 @@ typedef struct ptrmem_cst * ptrmem_cst_t; /* If set, this was imported in a using declaration. This is not to confuse with being used somewhere, which is not important for this node. */ -#define OVL_USED(NODE) TREE_USED (NODE) +#define OVL_USED(NODE) TREE_USED (OVERLOAD_CHECK (NODE)) /* If set, this OVERLOAD was created for argument-dependent lookup and can be freed afterward. */ #define OVL_ARG_DEPENDENT(NODE) TREE_LANG_FLAG_0 (OVERLOAD_CHECK (NODE)) diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 2b1f9fb..0fe0246 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -2316,8 +2316,7 @@ push_overloaded_decl_1 (tree decl, int flags, bool is_friend) && compparms (TYPE_ARG_TYPES (TREE_TYPE (fn)), TYPE_ARG_TYPES (TREE_TYPE (decl))) && ! decls_match (fn, decl)) - error ("%q#D conflicts with previous using declaration %q#D", - decl, fn); + diagnose_name_conflict (decl, fn); dup = duplicate_decls (decl, fn, is_friend); /* If DECL was a redeclaration of FN -- even an invalid @@ -2549,7 +2548,7 @@ do_nonmember_using_decl (tree scope, tree name, tree oldval, tree oldtype, if (new_fn == old_fn) /* The function already exists in the current namespace. */ break; - else if (OVL_USED (tmp1)) + else if (TREE_CODE (tmp1) == OVERLOAD && OVL_USED (tmp1)) continue; /* this is a using decl */ else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (new_fn)), TYPE_ARG_TYPES (TREE_TYPE (old_fn)))) @@ -2564,7 +2563,7 @@ do_nonmember_using_decl (tree scope, tree name, tree oldval, tree oldtype, break; else { - error ("%qD is already declared in this scope", name); + diagnose_name_conflict (new_fn, old_fn); break; } } |