Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22175

"invalid use of incomplete type" error with partial template specialization

$
0
0

The following code:

template <typename S, typename T>struct foo {   void bar();};template <typename T>void foo <int, T>::bar() {}

gives me the error

invalid use of incomplete type 'struct foo<int, T>'declaration of 'struct foo<int, T>'

(I'm using gcc.) Is my syntax for partial specialization wrong? Note that if I remove the second argument:

template <typename S>struct foo {   void bar();};template <>void foo <int>::bar() {}

then it compiles correctly.


Viewing all articles
Browse latest Browse all 22175

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>