passing as "const int &" to a function
Product: gcc
Version: 4.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: aij
--- Comment #2 from aijunbai at gmail dot com 2009-12-08 09:46 ---
(In reply to comment #1)
> You aren't defining anywhere A::i, just add, after struct A:
>
> const int A::i;
>
> and things will be fine.
>
> *** This bug has been marked as a duplicate o
--- Comment #5 from aijunbai at gmail dot com 2009-12-08 11:52 ---
(In reply to comment #4)
> (In reply to comment #3)
> > (In reply to comment #2)
> > > and i don't want to write lots of "const int A::i"...
> >
> > You have to, your code is
--- Comment #7 from aijunbai at gmail dot com 2009-12-08 13:02 ---
(In reply to comment #6)
> (In reply to comment #5)
> > >
> > > template const A::i;
> > >
> >
> > I tried so, but it seems do not work, could you please explain more
>
--- Comment #9 from aijunbai at gmail dot com 2009-12-08 14:06 ---
(In reply to comment #8)
> Then show here exactly what you are trying to compile. Note: this is *not*
> gcc-help.
>
alright, take the flowing code as an example:
template
struct A {
static const i