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

Re: Next round of new demangler patches


(1) std::string::~string()

    This is bad because it's not legal C++.  Try compiling the appended
    program with a typedef'd template.  I'm really opposed to emitting
    illegal C++ in a programmatic interface.

(2) std::string::~basic_string() is legal but it looks ugly.

    Although actually it kinda grows on me the more I look at it.  I
    know it's a destructor because it has a ~.  However the constructor,
    std::string::basic_string(), does not even look like a constructor!
    I think that std::string:basic_string() would astonish and confuse
    people.

(3) std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string

    This is legal and not as astonishing.  That's my favorite, so I'm
    glad that Ian picked it.

Michael C

===

template <class C> class tbase
{
  private:
    C c_;
  public:
    tbase ();
    ~tbase ();
};

template <class C> tbase<C>::tbase ()
{
  c_ = 0;
}

template <class C> tbase<C>::~tbase ()
{
  ;
}

typedef tbase<char> t1_char;
typedef tbase<int>  t2_int;

// This is legal.
t1_char::~tbase ()
{
  ;
}

// But this is not!
t2_int::~t2_int ()
{
  ;
}

int foo ()
{
  t1_char my_t1_char;
  t2_int  my_t2_int;
  return 0;
}


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