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++/42330] undefined reference to "static const int" in class when passing as "const int &" to a function



------- Comment #4 from redi at gcc dot gnu dot org  2009-12-08 09:50 -------
(In reply to comment #3)
> (In reply to comment #2)
> > and i don't want to write lots of "const int A<N>::i"...
> 
> You have to, your code is not valid if you use A::i in the program but it has
> no definition.  This is not a compiler bug.

Actually you don't have to write lots, just one:

template<int N> const A<N>::i;


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42330


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