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

[Bug c++/13917] New: template function not emitted.


Version 3.3 and higher do not emit code.
All lower versions also don't, but give an error.

Code snippet:

#if 0
typedef int type_nt;            // This compiles
type_nt const string = 0;
#else
enum type_nt {                  // This doesn't emit the template function.
  string
};
#endif

template<type_nt type, typename T>
  struct PX {
    T const* M_ptr;
    PX(T const* ptr) : M_ptr(ptr) { }
    template<type_nt _type, typename _T>
      friend void g(PX<_type, _T> const& p);
  };

template<int type, typename T>
  void g(PX<type, T> const& p) { }

void f()
{
  PX<string, char> p("hello");
  g(p);
}

-- 
           Summary: template function not emitted.
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: carlo at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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