diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1999-08-07 01:01:54 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1999-08-06 21:01:54 -0400 |
commit | 6ad073329cea8de835c2939dfb40c305f5568b72 (patch) | |
tree | 0207ce2b34a5962b32c2886da0b90ccf59340bee /gcc | |
parent | 446588abcb3251b1ef52cdab8f7b761354c1f8d6 (diff) | |
download | gcc-6ad073329cea8de835c2939dfb40c305f5568b72.zip gcc-6ad073329cea8de835c2939dfb40c305f5568b72.tar.gz gcc-6ad073329cea8de835c2939dfb40c305f5568b72.tar.bz2 |
decl.c (lookup_name_real): Set the complain flag if we're looking for a namespace member.
* decl.c (lookup_name_real): Set the complain flag if we're
looking for a namespace member.
* lex.c (real_yylex): We can have a number with no digits.
* cvt.c (cp_convert_to_pointer): Don't force pmf conversions.
* search.c (binfo_from_vbase): New fn.
* cp-tree.h: Declare it.
* cvt.c (cp_convert_to_pointer): Use it to diagnose conversion
from pointer to member of virtual base.
* typeck.c (get_delta_difference): Likewise.
From-SVN: r28560
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 15 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 1 | ||||
-rw-r--r-- | gcc/cp/cvt.c | 11 | ||||
-rw-r--r-- | gcc/cp/decl.c | 1 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 4 | ||||
-rw-r--r-- | gcc/cp/lex.c | 3 | ||||
-rw-r--r-- | gcc/cp/search.c | 14 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 4 |
8 files changed, 46 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c861db667..a9e045b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,18 @@ +1999-08-06 Jason Merrill <jason@yorick.cygnus.com> + + * decl.c (lookup_name_real): Set the complain flag if we're + looking for a namespace member. + + * lex.c (real_yylex): We can have a number with no digits. + + * cvt.c (cp_convert_to_pointer): Don't force pmf conversions. + + * search.c (binfo_from_vbase): New fn. + * cp-tree.h: Declare it. + * cvt.c (cp_convert_to_pointer): Use it to diagnose conversion + from pointer to member of virtual base. + * typeck.c (get_delta_difference): Likewise. + 1999-08-06 Alexandre Oliva <oliva@dcc.unicamp.br> * pt.c (tsubst): Use build_index_type to build in-template array diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 5c7f737..cc076a0 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -3343,6 +3343,7 @@ extern void reinit_search_statistics PROTO((void)); extern tree current_scope PROTO((void)); extern tree lookup_conversions PROTO((tree)); extern tree binfo_for_vtable PROTO((tree)); +extern int binfo_from_vbase PROTO((tree)); extern tree dfs_walk PROTO((tree, tree (*)(tree, void *), tree (*) (tree, void *), diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 6766559..72cbcaf 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -1,5 +1,5 @@ /* Language-level data type conversion for GNU C++. - Copyright (C) 1987, 88, 92-97, 1998 Free Software Foundation, Inc. + Copyright (C) 1987-1988, 1992-1999 Free Software Foundation, Inc. Hacked by Michael Tiemann (tiemann@cygnus.com) This file is part of GNU CC. @@ -199,6 +199,13 @@ cp_convert_to_pointer (type, expr) if (binfo == error_mark_node) return error_mark_node; + if (binfo_from_vbase (binfo)) + { + cp_error ("conversion to `%T' from pointer to member of virtual base `%T'", + type, intype); + return error_mark_node; + } + if (TREE_CODE (expr) == PTRMEM_CST) expr = cplus_expand_constant (expr); @@ -217,7 +224,7 @@ cp_convert_to_pointer (type, expr) return rval; } else if (TYPE_PTRMEMFUNC_P (type) && TYPE_PTRMEMFUNC_P (intype)) - return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 1); + return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 0); else if (TYPE_PTRMEMFUNC_P (intype)) { cp_error ("cannot convert `%E' from type `%T' to type `%T'", diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 93eb61f..038b099 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5707,6 +5707,7 @@ lookup_name_real (name, prefer_type, nonclass, namespaces_only) { struct tree_binding b; val = binding_init (&b); + flags |= LOOKUP_COMPLAIN; if (!qualified_lookup_using_namespace (name, type, val, flags)) return NULL_TREE; val = select_decl (val, flags); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index a841319..c16f1fd 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -4421,8 +4421,8 @@ lookup_using_namespace (name, val, usings, scope, flags) } /* [namespace.qual] - Excepts the name to lookup and its qualifying scope. - Returns the name/type pair found into the CPLUS_BINDING result, + Accepts the NAME to lookup and its qualifying SCOPE. + Returns the name/type pair found into the CPLUS_BINDING RESULT, or 0 on error. */ int diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 5afda55..e423652 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -3973,8 +3973,9 @@ real_yylex () } } + /* This can happen on input like `int i = 0x;' */ if (numdigits == 0) - my_friendly_abort (990710); + error ("numeric constant with no digits"); if (largest_digit >= base) error ("numeric constant contains digits beyond the radix"); diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 14e1ce9..dc898cd 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -3315,3 +3315,17 @@ binfo_for_vtable (var) return dfs_walk_real (TYPE_BINFO (type), 0, dfs_bfv_helper, dfs_bfv_queue_p, &bfvi); } + +/* Returns 1 iff BINFO is from a direct or indirect virtual base. */ + +int +binfo_from_vbase (binfo) + tree binfo; +{ + for (; binfo; binfo = BINFO_INHERITANCE_CHAIN (binfo)) + { + if (TREE_VIA_VIRTUAL (binfo)) + return 1; + } + return 0; +} diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 03bc2c0..a4d6573 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -6213,7 +6213,7 @@ get_delta_difference (from, to, force) binfo = get_binfo (to, from, 1); if (binfo == 0 || binfo == error_mark_node) return delta; - if (TREE_VIA_VIRTUAL (binfo)) + if (binfo_from_vbase (binfo)) { binfo = binfo_member (BINFO_TYPE (binfo), CLASSTYPE_VBASECLASSES (from)); @@ -6229,7 +6229,7 @@ get_delta_difference (from, to, force) delta); } - if (TREE_VIA_VIRTUAL (binfo)) + if (binfo_from_vbase (binfo)) { if (force) { |