Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-8564

Core Issue 1804 unimplemented: friend declaration does not apply to class template specializations

    XMLWordPrintable

Details

    • Bug
    • Status: New
    • Medium
    • Resolution: Unresolved
    • Code Generation Tools
    • CODEGEN-3962
    • Hide
      ARM_18.1.0.LTS
      MSP430_18.1.0.LTS
      MSP430_20.2.0.LTS
      ARM_18.12.0.LTS
      MSP430_21.6.0.LTS
      MSP430_18.12.0.LTS
      ARM_20.2.0.LTS
      Show
      ARM_18.1.0.LTS MSP430_18.1.0.LTS MSP430_20.2.0.LTS ARM_18.12.0.LTS MSP430_21.6.0.LTS MSP430_18.12.0.LTS ARM_20.2.0.LTS
    • Hide
      The compiler does not yet implement the resolution to core issue 1804 involving template friend declarations applying to specializations of a class template. In the following code sample, a member of class C is inaccessible through a template friend declaration when the associated class template is a specialization.

      class C_;

      // Class template
      template<class T> struct A_ {
        int f(const C_&);
        struct D {
          int g() { return 8; }
        };
      };

      // Specialization
      template<> struct A_<int> {
        int f(const C_&);
        struct D {
          int g() { return 18; }
        };
      };

      class C_ {
        template<class T> friend int A_<T>::f(const C_&); // friend declaration
        int member;
      public:
        C_(int i) : member(i) { }
      };

      template<class U>
      int A_<U>::f(const C_& c)
        { return c.member; } // Not specialized, C::member is accessible

      int A_<int>::f(const C_& c)
        { return 10+c.member; } // Specialized, C::member is inaccessible
      Show
      The compiler does not yet implement the resolution to core issue 1804 involving template friend declarations applying to specializations of a class template. In the following code sample, a member of class C is inaccessible through a template friend declaration when the associated class template is a specialization. class C_; // Class template template<class T> struct A_ {   int f(const C_&);   struct D {     int g() { return 8; }   }; }; // Specialization template<> struct A_<int> {   int f(const C_&);   struct D {     int g() { return 18; }   }; }; class C_ {   template<class T> friend int A_<T>::f(const C_&); // friend declaration   int member; public:   C_(int i) : member(i) { } }; template<class U> int A_<U>::f(const C_& c)   { return c.member; } // Not specialized, C::member is accessible int A_<int>::f(const C_& c)   { return 10+c.member; } // Specialized, C::member is inaccessible

    Description

      Core Issue 1804 unimplemented: friend declaration does not apply to class template specializations

      Attachments

        Activity

          People

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: