NatsukiHosono/FDPS_SPH

Compiling needs -fpermissive on gcc 7.3.0

gassmoeller opened this issue · 1 comments

Hi Natsuki, I have started looking into the code, and will collect problems that I find in these github issues.

First I ran into a compiling problem with gcc 7.3.0. I get the following error message:

init/GI.h: At global scope:
init/GI.h:8:22: error: ‘constexpr’ needed for in-class initialization of static data member ‘const double GI<Ptcl>::END_TIME’ of non-integral type [-fpermissive]
  static const double END_TIME = 1.0e+4;
                      ^~~~~~~~
In file included from main.cpp:15:0:
force.h:82:23: error: ‘constexpr’ needed for in-class initialization of static data member ‘const double STD::CalcGravityForce<TPtclJ>::G’ of non-integral type [-fpermissive]
   static const double G = 6.67e-11;
                       ^
In file included from main.cpp:14:0:
init/GI.h: In instantiation of ‘class GI<STD::RealPtcl>’:
main.cpp:37:10:   required from here
init/GI.h:8:22: error: ‘constexpr’ needed for in-class initialization of static data member ‘const double GI<STD::RealPtcl>::END_TIME’ of non-integral type [-fpermissive]
  static const double END_TIME = 1.0e+4;
                      ^~~~~~~~
In file included from main.cpp:15:0:
force.h: In instantiation of ‘class STD::CalcGravityForce<STD::EPJ::Grav>’:
main.cpp:77:77:   required from here
force.h:82:23: error: ‘constexpr’ needed for in-class initialization of static data member ‘const double STD::CalcGravityForce<STD::EPJ::Grav>::G’ of non-integral type [-fpermissive]
   static const double G = 6.67e-11;
                       ^
force.h: In instantiation of ‘class STD::CalcGravityForce<ParticleSimulator::SPJMonopole>’:
main.cpp:77:120:   required from here
force.h:82:23: error: ‘constexpr’ needed for in-class initialization of static data member ‘const double STD::CalcGravityForce<ParticleSimulator::SPJMonopole>::G’ of non-integral type [-fpermissive]
In file included from main.cpp:16:0:

Using the -fpermissive flags reduces these errors to warnings (then it compiles for me), but the more correct fix would of course be to use constexpr in front of these initializations.

This should have been fixed by #4.