[Bug c++/15199] New: Error in partial specialization of template class member function

cyckie at earthlink dot net gcc-bugzilla@gcc.gnu.org
Thu Apr 29 10:27:00 GMT 2004


This code:

template <typename T1, typename T2>
class A
{
public:
  A(T1 theval1, T2 theval2):_val1(theval1),_val2(theval2) { }

  void func(T1 theT1, T2 theT2) { }

private:
  T1 _val1;
  T2 _val2;
};

template <typename T2>
void
A<char*,T2>::func(char *theT1, T2 theT2)
{
}

int
main()
{
}

Compiled with this command line:

g++ -c -Wall partial-spec.cpp

Gives these errors

partial-spec.cpp:17: error: invalid use of undefined type `class A<char*, T2>'
partial-spec.cpp:3: error: declaration of `class A<char*, T2>'
partial-spec.cpp:17: error: template definition of non-template `void A<char*,
T2>::func(char*, T2)'

Release:
3.4.0

Environment:
System: Linux pillsbury 2.4.22-1.2115.nptl #1 Wed Oct 29 15:31:21 EST 2003 i686
athlon i386 GNU/Linux
Architecture: i686

host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: --prefix=/usr/local/gcc-3.4.0

-- 
           Summary: Error in partial specialization of template class member
                    function
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: cyckie at earthlink dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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



More information about the Gcc-bugs mailing list