public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/3738: static member variables are well handled bycontainers
@ 2001-08-23 23:46 Luca Formaggia
0 siblings, 0 replies; only message in thread
From: Luca Formaggia @ 2001-08-23 23:46 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR libstdc++/3738; it has been noted by GNATS.
From: Luca Formaggia <Luca.Formaggia@epfl.ch>
To: gcc-gnats@gcc.gnu.org
Cc:
Subject: Re: libstdc++/3738: static member variables are well handled
bycontainers
Date: Fri, 24 Aug 2001 08:40:36 +0200
Following your suggestion I am annexing the working and not working examples.
The not working example compiles with g++ version 2.96, while version 3.0 gives
$/usr/LOCAL/bin/g++ notworking.cc
/tmp/ccHhDZuS.o: In function `main':
/tmp/ccHhDZuS.o(.text+0x33): undefined reference to `A::a1'
collect2: ld returned 1 exit status
========== notworking.cc
#include<vector>
#include<iostream>
using namespace std;
class A
{
public:
static const int a1=10;
};
int main()
{
vector<A> v1(10);
cout<< v1[1].a1<<endl;
}
========working.cc
#include<vector>
#include<iostream>
using namespace std;
class A
{
public:
static const int a1=10;
};
int main()
{
vector<A> v1(10);
A p1(v1[1]);
cout<< p1.a1<<endl;
}
--
--------------------------------------------------------------------------
Luca Formaggia | mailto:Luca.Formaggia@epfl.ch
Modelling and Scientific Computing | http://dmawww.epfl.ch/~forma
Mathematics Department | office: MA C2 524
Ecole Polytechnique Federale de Lausanne | voice: +4121 6934267
CH-1015 Lausanne, Switzerland | fax: +4121 6934303
--------------------------------------------------------------------------
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-08-23 23:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-23 23:46 libstdc++/3738: static member variables are well handled bycontainers Luca Formaggia
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).