Skip to content

#1655 nullptr.hh does not compile with g++ 4.8.2

Metadata

Property Value
Reported by Tobias Ritschel (tobiasritschel@gmail.com)
Reported at May 20, 2015 16:45
Type Bug Report
Version 2.3
Operating System Linux 64bit
Last edited by Dominic Kempf (dominic.r.kempf@gmail.com)
Last edited at May 21, 2015 10:48
Closed by Dominic Kempf (dominic.r.kempf@gmail.com)
Closed at May 21, 2015 10:48
Closed in version Unknown
Resolution Not a bug
Comment

Description

Hi

I am using Dune through OPM (http://www.opm-project.org). I would like to use ISTL to solve linear systems using Eigen matrices. To do this I use DuneMatrix.hpp from OPM. Eventually it includes nullptr.hh.

I compile using g++ 4.8.2 with -std=c++11. I cannot find the version of Dune that I am using, but I installed it using sudo on Apr 13 2015 on Ubuntu 14.04LTS. I get the following error message

/home/tobias/Documents/petsc/arch-linux2-c-debug/bin/mpicxx -o src/OPMSim.o -c -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -g -O0  -fPIC   -std=c++11 -Wall -g -DNDEBUG -O1 -I/home/tobias/Documents/petsc/include -I/home/tobias/Documents/petsc/arch-linux2-c-debug/include    `pwd`/src/OPMSim.cpp
In file included from /usr/include/dune/common/shared_ptr.hh:17:0,
                 from /usr/include/dune/istl/bcrsmatrix.hh:19,
                 from /usr/local/include/opm/autodiff/DuneMatrix.hpp:38,
                 from /home/tobias/Documents/OPM_Optimization/src/../header/OPMSim.hpp:22,
                 from /home/tobias/Documents/OPM_Optimization/src/OPMSim.cpp:1:
/usr/include/dune/common/nullptr.hh:29:1: error: expected ‘;’ after class definition
 } nullptr = {};              // and whose name is nullptr
 ^
/usr/include/dune/common/nullptr.hh:29:1: error: qualifiers can only be specified for objects and functions
/usr/include/dune/common/nullptr.hh:29:3: error: expected unqualified-id before ‘nullptr’
 } nullptr = {};              // and whose name is nullptr
   ^
make: *** [src/OPMSim.o] Error 1

I can see that this part of the code is not called if HAVE_NULLPTR is set to true. As far as I know gcc 4.6 and higher has nullptr and so I don't believe it should be a problem.

I could only find one other bug report concerning this file, but the problem seems to be another. Do I need to make sure to include other Dune header files or could I just set

#define HAVE_NULLPTR 1

Any help would be much appreciated.

Kind regards Tobias