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]

specialization bug


gcc version - 2.95.2 19991024 
system type - sparc-sun-solaris2.6
comand line - gcc ttest2.cpp -lstdc++
compiler output:
--------
ttest2.cpp:8: explicit specialization in non-namespace scope `narf<C>'
ttest2.cpp:8: enclosing class templates are not explicitly specialized
ttest2.cpp:8: syntax error before `{'
ttest2.cpp:10: warning: all member functions in class `narf<C>' are private
ttest2.cpp:10: semicolon missing after declaration of `narf<C>'
ttest2.cpp:10: parse error at null character
ttest2.cpp: In function `bool gorp()':
ttest2.cpp:13: `mData' undeclared (first use this function)
ttest2.cpp:13: (Each undeclared identifier is reported only once
ttest2.cpp:13: for each function it appears in.)
ttest2.cpp:13: implicit declaration of function `int foo(...)'
ttest2.cpp: At top level:
ttest2.cpp:14: parse error before `}'
--------------------------------------------------
preprocessed file:
------------------------------------------------
# 1 "ttest2.cpp"
template <class C> class narf
{
private:

 C mData;

 template <class T> bool foo(T &v) { return true; }
 template <> bool foo(bool &v) { v = true; return false; }

public:

 narf() {}
 bool gorp() { return foo(mData); }
};


int main(int argc,char *argv[])
{
 narf<int> i;
 narf<bool> b;

 return 0;
}
---------------------------------------------------------------

ttest2.cpp


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