This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: messages private members


Benjamin Kosnik <bkoz@redhat.com> writes:

| >does not seem to have been tested.  It results into a hard error
| >because inaccessibility in
| >std::messages_byname<_CharT>::messages_byname.
| 
| I tested this with xgcc (GCC) 3.4 20030928 (experimental). Has something
| changed since then?

Here is the code I have.

  // 22.1.1.1.2  Class locale::facet
  class locale::facet
  {
  private:
    friend class locale;
    friend class locale::_Impl;

    mutable _Atomic_word                _M_references;

    // Contains data from the underlying "C" library for the classic
    locale.
    static __c_locale                   _S_c_locale;

    // String literal for the name of the classic locale.
    static const char                   _S_c_name[2];

  [...]

  template<typename _CharT>
    class messages : public locale::facet, public messages_base
    {
    public:
      // Types:
      typedef _CharT                    char_type;
      typedef basic_string<_CharT>      string_type;

    protected:
      // Underlying "C" library locale information saved from
      // initialization, needed by messages_byname as well.
      __c_locale                        _M_c_locale_messages;

   [...]

Note that members of locale::facet shown above are inacessible in
messaages<_Chart>.  In particular, given

  template<typename _CharT>
    class messages_byname : public messages<_CharT>
    {
    public:
      typedef _CharT                    char_type;
      typedef basic_string<_CharT>      string_type;

      explicit 
      messages_byname(const char* __s, size_t __refs = 0);

  [...]

they are inaccessible in messages_byname<_CharT>, hence in its
constructor:

   // messages_byname
   template<typename _CharT>
     messages_byname<_CharT>::messages_byname(const char* __s, size_t  __refs)
     : messages<_CharT>(__refs)
     {
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
       if (this->_S_c_name != this->_M_name_messages)
              ^^^^^^^

This is not OK.

-- Gaby


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