This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/22354] g++ accepts specializiation without declaration
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Jul 2005 20:34:20 -0000
- Subject: [Bug c++/22354] g++ accepts specializiation without declaration
- References: <20050707190900.22354.tneumann@pi3.informatik.uni-mannheim.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bangerth at dealii dot org 2005-07-07 20:34 -------
The use of the address-of operator in Andrew's snippet is pretty confusing.
Take this instead:
---------------------
template <int i> struct B {
static int b;
};
template<> int B<1>::b = B<2>::b;
template<> int B<2>::b;
---------------------
g/x> icc -Xc -ansi -c x.cc
x.cc(6): warning #836: explicit specialization of member "B<i>::b [with i=2]"
must precede its first use
template<> int B<2>::b;
^
g/x> /home/bangerth/bin/gcc-4.1-pre/bin/c++ -c -W -Wall -pedantic -ansi x.cc
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22354