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]
Other format: [Raw text]

[Bug c++/22354] g++ accepts specializiation without declaration


------- 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


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