Bug 433580 - g++ does not issue accessibility error
Summary: g++ does not issue accessibility error
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: gcc
Version: 5.0
Hardware: i686
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-02-20 04:50 UTC by Judy Ward
Modified: 2013-11-26 18:14 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-11-26 18:14:11 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Judy Ward 2008-02-20 04:50:32 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.5.20404)

Description of problem:
/*
This shows a Gnu compiler bug. The Intel Linux compiler and the latest
Microsoft (MSVC++ 2008) compiler give an error but Gnu does not.

Stroustrup's C++ Programming Language 3rd edition, section 15.3.2 says:
If B is a protected base ... Only friends and members of D and friends
and members of class derived from D can convert D* to a B*.

In this example Base is a protected base and Base is not derived
from Derived so this should get an error.
*/

struct Base
{
    void baseFunction() ;
};

// g++ gives an error if Base is private -- but not protected
class Derived : protected Base // no error with g++
{};

void Base::baseFunction()
{
  Derived* dp = 0;
  Base* bp = 0;
  bp = dp;
}


Version-Release number of selected component (if applicable):
gcc version 4.1.1 20070105 

How reproducible:
Always


Steps to Reproduce:
1. g++ bug.cpp
2.
3.

Actual Results:

I did not see a compilation error.

Expected Results:

I should have seen an error similar to this one from the Intel compiler:

tr78887a.cpp(26): error #312: conversion to inaccessible base class "Base" is not allowed
    bp = dp;
         ^



Additional info:

Comment 2 Jeff Law 2013-11-26 18:14:11 UTC
This Bugzilla has been reviewed by Red Hat and is not planned on being
addressed in Red Hat Enterprise Linux 5, and therefore will be closed.
If this bug is critical to production systems, please contact your Red
Hat support representative and provide sufficient business
justification. Issue is already fixed in RHEL-6/7 as well as in the Developer Tool Set compilers which are available for RHEL-5.


Note You need to log in before you can comment on or make changes to this bug.