public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/3462: base class ctor in initializer list problem
@ 2001-06-28 10:36 Artem Khodush
0 siblings, 0 replies; 3+ messages in thread
From: Artem Khodush @ 2001-06-28 10:36 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/3462; it has been noted by GNATS.
From: "Artem Khodush" <artem@duma.gov.ru>
To: <David.Partridge@primeur.com>
Cc: <gcc-gnats@gcc.gnu.org>, <gcc-bugs@gcc.gnu.org>
Subject: Re: c++/3462: base class ctor in initializer list problem
Date: Thu, 28 Jun 2001 21:19:42 +0400
> template<class o> class asn_occupiedsetof : public asn_setof<o> {
> public:
> asn_occupiedsetof(security_t s = ASN_PUBLIC) : asn_setof(s) {
> ASN_OBJTYPE("OSETOF");
> set_empty_permitted(false);
> };
> asn_occupiedsetof(unsigned children, security_t s = ASN_PUBLIC)
> : asn_setof(children, s) {
> ASN_OBJTYPE("OSETOF");
> set_empty_permitted(false);
> };
> };
>
...
> We're actualy trying to fire the base class ctor of course,
And the name for that class is asn_setof<o>, not just asn_setof.
> not to initialise a field, but it seems g++ has got a bit
> confused - I think - I'm not a language lawyer on templated
> classes with inheritance :-(
>
I'm not a language lawyer too, but I'm pretty sure that
in standard c++, only the name of template class itself
may appear in the class definition not followed by <>.
The names of any other classes, including bases, must
always be spelled in full.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c++/3462: base class ctor in initializer list problem
@ 2001-07-25 6:52 nathan
0 siblings, 0 replies; 3+ messages in thread
From: nathan @ 2001-07-25 6:52 UTC (permalink / raw)
To: David.Partridge, gcc-bugs, gcc-prs, nobody
Synopsis: base class ctor in initializer list problem
State-Changed-From-To: open->closed
State-Changed-By: nathan
State-Changed-When: Wed Jul 25 06:52:38 2001
State-Changed-Why:
not a bug. As the provided code is not complete, I cannot
completely verify what you're trying to do, but Artem's
analysis is correct. You must use a template id expr
for the base class initializers -- consider if you had two
different instantiations of the same template for bases.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3462&database=gcc
^ permalink raw reply [flat|nested] 3+ messages in thread
* c++/3462: base class ctor in initializer list problem
@ 2001-06-28 8:06 David.Partridge
0 siblings, 0 replies; 3+ messages in thread
From: David.Partridge @ 2001-06-28 8:06 UTC (permalink / raw)
To: gcc-gnats
>Number: 3462
>Category: c++
>Synopsis: base class ctor in initializer list problem
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jun 28 08:06:02 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: David C. Partridge
>Release: g++ 2.96.85
>Organization:
>Environment:
Red Hat Linux 7
>Description:
I'm trying to compile some templated classes that are in an
inheritance heirarchy. So far they built fine using MS
Visual C++ 6, IBM C/C++ compiler for MVS, IBM Visual Age C++
Version 5 for AIX.
The source header that is causing the problem is huge and is
also dependent on others, but I believe that I only need
to show a fragment.
template<class o> class asn_setof : public asn_set {
public:
virtual int decode_value(r_buffer_t & buf,
uint32 value_length) {
r_buffer_t temp_buf = buf;
o * new_member;
int result = 0;
bool done = false;
empty();
if (!indefinite_length) {
temp_buf.data_len = value_length;
};
while (!done) {
if (indefinite_length) {
if (check_EOC(temp_buf)) done = 1;
} else if (temp_buf.data_len == 0) done = 1;
if (!done) {
new_member = new o(security);
if ((result = new_member->read(temp_buf)) != 0) {
delete new_member;
return result;
};
register_child(new_member);
};
};
if (!indefinite_length) {
temp_buf.data_len = buf.data_len - value_length;
};
buf = temp_buf;
return 0;
};
protected:
virtual int emptyi(void) {
unsigned i;
for (i=0; i<child_count; i++) {
delete child[i];
child[i] = NULL;
};
child_count = 0;
invalidate_encoding();
return 0;
};
public:
virtual int delete_child(unsigned ix) {
o * theChild = get_child(ix);
unsigned i;
if (theChild == NULL) return ASN_INVALID_PARAMETER;
for (i=ix; i<child_count-1; i++) {
child[i] = child[i+1];
};
delete theChild;
child[child_count-1] = NULL;
child_count--;
is_sorted = false;
invalidate_encoding();
return 0;
};
virtual o * add_child(void) {
o * new_member = new o(security);
if (register_child(new_member) != 0) {
delete new_member;
return NULL;
} else return new_member;
};
virtual o * add_child_before(void) {
o * new_member = new o(security);
if (register_child_before(new_member) != 0) {
delete new_member;
return NULL;
} else return new_member;
};
virtual int set_optional(bool opt = true) {
if (opt) set_empty_permitted(false); // if optional, we don't want an empty sequence.
return asn_set::set_optional(opt);
};
asn_setof(security_t s = ASN_PUBLIC) : asn_set(s) {
ASN_OBJTYPE("SETOF");
set_value_valid(); // An empty set is valid
};
asn_setof(unsigned children, security_t s = ASN_PUBLIC)
: asn_set(children, s) {
ASN_OBJTYPE("SETOF");
set_value_valid(); // An empty set is valid
};
virtual ~asn_setof() {
emptyi();
};
o * get_child_sorted(unsigned i) const {
sort_children();
if (i < child_count) return (o *)(sorted_child[i]); else return NULL;
};
o * get_child(unsigned i) const {
return (o *)(asn_set::get_child(i));
};
o * operator [] (unsigned i) const {
return get_child(i);
};
};
template<class o> class asn_occupiedsetof : public asn_setof<o> {
public:
asn_occupiedsetof(security_t s = ASN_PUBLIC) : asn_setof(s) {
ASN_OBJTYPE("OSETOF");
set_empty_permitted(false);
};
asn_occupiedsetof(unsigned children, security_t s = ASN_PUBLIC)
: asn_setof(children, s) {
ASN_OBJTYPE("OSETOF");
set_empty_permitted(false);
};
};
The problem is reportedat compile time is:
include/asnbase.h: In method `asn_occupiedsetof<o>::asn_occupiedsetof
(security_t)':
include/asnbase.h:949: class `asn_occupiedsetof<o>' does not have any
field named `asn_setof'
We're actualy trying to fire the base class ctor of course,
not to initialise a field, but it seems g++ has got a bit
confused - I think - I'm not a language lawyer on templated
classes with inheritance :-(
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-07-25 6:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-28 10:36 c++/3462: base class ctor in initializer list problem Artem Khodush
-- strict thread matches above, loose matches on Subject: below --
2001-07-25 6:52 nathan
2001-06-28 8:06 David.Partridge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).