This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15244] New: definition of nontrivial static members of template class using g++ 3.4.0
- From: "militzer at gl dot ciw dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 May 2004 16:47:03 -0000
- Subject: [Bug c++/15244] New: definition of nontrivial static members of template class using g++ 3.4.0
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Why does not the code below compile under 3.4.0. I know the template handling is
much stricter in 3.4.0 but I could not figure out how to define the static
nontrivial member "volume". Thanks for checking into this. It compiles under 3.3.2.
---------------------
template <int n>
class ShortVector {
public:
double v[n];
static const int nDim = 10;
static double volume;
};
// const int ShortVector < 3 > :: nDim;
double ShortVector < 3 > :: volume;
int main() {
ShortVector < 3 > a;
a.volume = 2.0*double(a.nDim);
}
--
Summary: definition of nontrivial static members of template
class using g++ 3.4.0
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: militzer at gl dot ciw dot edu
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15244