diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-12-01 11:52:33 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-12-01 11:52:33 +0000 |
commit | 0512aab84ff3ad06f5a0ff2b32329dadf33678c0 (patch) | |
tree | f80d9f0fedea5248099a5177e8a9fea9a12d0a08 /gcc/cp/call.c | |
parent | e5ab4c7a98c342646511efba0b7b829a731a0590 (diff) | |
download | ppe42-gcc-0512aab84ff3ad06f5a0ff2b32329dadf33678c0.tar.gz ppe42-gcc-0512aab84ff3ad06f5a0ff2b32329dadf33678c0.zip |
cp:
* call.c (standard_conversion): Reject pointer to member
conversions from ambiguous, inaccessible or virtual bases.
* typeck.c (build_static_cast): Don't check pointers to members
specially.
testsuite:
* g++.old-deja/g++.other/cast6.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37914 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r-- | gcc/cp/call.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index ecd3d22347e..fd5f9046382 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -736,8 +736,9 @@ standard_conversion (to, from, expr) { tree fbase = TYPE_OFFSET_BASETYPE (TREE_TYPE (from)); tree tbase = TYPE_OFFSET_BASETYPE (TREE_TYPE (to)); + tree binfo = get_binfo (fbase, tbase, 1); - if (DERIVED_FROM_P (fbase, tbase) + if (binfo && !binfo_from_vbase (binfo) && (same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (TREE_TYPE (from)), TREE_TYPE (TREE_TYPE (to))))) @@ -783,11 +784,12 @@ standard_conversion (to, from, expr) tree tofn = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (to)); tree fbase = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fromfn))); tree tbase = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (tofn))); + tree binfo = get_binfo (fbase, tbase, 1); - if (! DERIVED_FROM_P (fbase, tbase) - || ! same_type_p (TREE_TYPE (fromfn), TREE_TYPE (tofn)) - || ! compparms (TREE_CHAIN (TYPE_ARG_TYPES (fromfn)), - TREE_CHAIN (TYPE_ARG_TYPES (tofn))) + if (!binfo || binfo_from_vbase (binfo) + || !same_type_p (TREE_TYPE (fromfn), TREE_TYPE (tofn)) + || !compparms (TREE_CHAIN (TYPE_ARG_TYPES (fromfn)), + TREE_CHAIN (TYPE_ARG_TYPES (tofn))) || CP_TYPE_QUALS (fbase) != CP_TYPE_QUALS (tbase)) return 0; |