This is the mail archive of the gcc-prs@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]

c++/3462: base class ctor in initializer list problem



>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:


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