This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/8033: compile error when calling base class protected constructor from derived class function


>Number:         8033
>Category:       c++
>Synopsis:       compile error when calling base class protected constructor from derived class function
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 25 04:36:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     ori hecht
>Release:        2.95.3-5 (cygwin special)
>Organization:
>Environment:
cygwin on win2000
>Description:
The compiler refuses to call a protected constructor of a base class from a member function of a class derived from it.

The compiler output is:

tst.c: In method 'class B * Derived::bad()':
tst.c:10: 'Base::Base(int)' is protected
tst.c:21: within this context
 

NOTE: how can I attach both the .c file and the .ii file through the GNATS interface? The selector allows me only one choice.
>How-To-Repeat:
g++ tst.c
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="tst.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="tst.c"

DQoNCmNsYXNzIEJhc2Ugew0KICBwdWJsaWM6DQogICAgdmlydHVhbCB+QmFzZSgpIHt9DQoNCiAg
ICBCYXNlKiBiYWRCKHZvaWQpIHtyZXR1cm4gbmV3IEJhc2UoNSk7fQ0KDQogIHByb3RlY3RlZDoN
CiAgICBCYXNlKGludCkge30NCg0KICAgIGludCBnKGludCkge3JldHVybiA1O30NCn07DQoNCg0K
Y2xhc3MgRGVyaXZlZDogcHVibGljIEJhc2Ugew0KICBwdWJsaWM6DQogICAgRGVyaXZlZCh2b2lk
KTogQmFzZSgzKSB7fQ0KICAgIHZpcnR1YWwgfkRlcml2ZWQoKSB7fQ0KDQogICAgQmFzZSogYmFk
RCh2b2lkKSB7cmV0dXJuIG5ldyBCYXNlKDUpO30NCiAgICBpbnQgZ29vZCh2b2lkKSB7cmV0dXJu
IGcoNyk7fQ0KfTsNCg0KaW50IG1haW4oKQ0Kew0KICByZXR1cm4gMTsNCn0NCg0K


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]