The following code produces an error on the second line inside of main:
error: no match for 'operator<<' in 'std::cout << C<int>::E()'
C++ frontend fails to find the templetized operator<<.

---------- begin code ------------

#include <iostream>
using namespace std;

template<typename T>
struct C {
  struct E {
  };
};

template<typename T>
ostream& operator<<(ostream &ss, const C<T> &t) {
  return (ss);
}

template<typename T>
ostream& operator<<(ostream &ss, const typename C<T>::E &t) {
  return (ss);
}

main() {
  cout << C<int>();     // this compiles ok
  cout << C<int>::E();  // this fails
}


-- 
           Summary: Operator<< for embedded class of templetized class isn't
                    found
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: yuri at tsoft dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35275

Reply via email to