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++/15244] New: definition of nontrivial static members of template class using g++ 3.4.0


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


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