[Bug c++/14870] New: Explicit template instantiation wrong scope accepted

kerch at cup dot hp dot com gcc-bugzilla@gcc.gnu.org
Wed Apr 7 00:22:00 GMT 2004


This code is accepted by g++ but should be flagged. 
14.7.2 P3 suggests that the definition of a class template
shall be in scope at the point of explicit instantiation.
This may be related to the bug 13294.
================
template <class T> class X { 
  public:
    void f(const T&);
};
template <class T> void X<T>::f(const T&) { }
template class X<int>;
namespace foo {
  template class X<double>;  // 14.7.2 P3 disallows this
};

-- 
           Summary: Explicit template instantiation wrong scope accepted
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kerch at cup dot hp dot com
                CC: gcc-bugs at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list