This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
specialization bug
- To: <gcc-bugs at gcc dot gnu dot org>
- Subject: specialization bug
- From: "Neil Radisch" <nradisch at panix dot com>
- Date: Mon, 16 Oct 2000 12:18:11 -0400
- Cc: "Neil Radisch" <nradisch at panix dot com>
- Reply-To: "Neil Radisch" <nradisch at panix dot com>
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