You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Build BAT on travis with all standards >= C++03 #329
An even simpler way might be to enforce the C++ standard in the build flags to ensure that future deprecations don't lead to trouble. But of course that would lead to problems when integrated in more modern software that needs a newer standard. I guess the best of both worlds would be if just the headers were written in the common subset of C++03, up to C++20
I build bat with g++-9.3 and root 6.22 that sets -std=c++11 itself
../configure CXXFLAGS='-std=c++03' # fails with root6
../configure CXXFLAGS='-std=c++11' # works
../configure CXXFLAGS='-std=c++14' # works
../configure CXXFLAGS='-std=c++17'
make[3]: Entering directory '/home/fred/workspace/bat/build/src'
/bin/bash ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../src -I.. -pthread -std=c++11 -m64 -Wall -fPIC -I../../BAT -I.includes -I/home/fred/software/root-6.22.00/include -O2 -Wno-unknown-pragmas -std=c++17 -MT BCHistogramBase.lo -MD -MP -MF .deps/BCHistogramBase.Tpo -c -o BCHistogramBase.lo ../../src/BCHistogramBase.cxx
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../src -I.. -pthread -std=c++11 -m64 -Wall -fPIC -I../../BAT -I.includes -I/home/fred/software/root-6.22.00/include -O2 -Wno-unknown-pragmas -std=c++17 -MT BCHistogramBase.lo -MD -MP -MF .deps/BCHistogramBase.Tpo -c ../../src/BCHistogramBase.cxx -fPIC -DPIC -o .libs/BCHistogramBase.o
In file included from /home/fred/software/root-6.22.00/include/TString.h:28,
from /home/fred/software/root-6.22.00/include/TPave.h:17,
from /home/fred/software/root-6.22.00/include/TLegend.h:16,
from ../../BAT/BCHistogramBase.h:25,
from ../../src/BCHistogramBase.cxx:11:
/home/fred/software/root-6.22.00/include/ROOT/RStringView.hxx:32:10: error: conflicting declaration of template ‘template<class _CharT, class _Traits> using basic_string_view = std::experimental::__ROOT::basic_string_view<_CharT, _Traits>’
32 | using basic_string_view = ::std::experimental::basic_string_view<_CharT,_Traits>;
| ^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/9/bits/basic_string.h:48,
from /usr/include/c++/9/string:55,
from ../../BAT/BCHistogramBase.h:22,
from ../../src/BCHistogramBase.cxx:11:
/usr/include/c++/9/string_view:90:11: note: previous declaration ‘template<class _CharT, class _Traits> class std::basic_string_view’
90 | class basic_string_view
| ^~~~~~~~~~~~~~~~~
So I conclude root itself doesn't build with c++17 and there is nothing gained in making BAT ready for C++17 yet. I'd rather set the c++ standard in BAT to c++11. We just didn't do this before to support even older compilers before gcc 4.8. But it's 2020 now, and I rather support existing users with modern compilers than an unknown user with a very old compiler.
I read that gcc11 will use c++17 by default, so future distros shipping that compiler would also get users into trouble if we don't specify a standard and someone used an older version root5
Activity
fredRos commentedon Aug 3, 2020
An even simpler way might be to enforce the C++ standard in the build flags to ensure that future deprecations don't lead to trouble. But of course that would lead to problems when integrated in more modern software that needs a newer standard. I guess the best of both worlds would be if just the headers were written in the common subset of C++03, up to C++20
gcc 9.3 available in ubuntu 20.04 has full support for C++17. There is no full support for C++20 yet, even in g++11 https://gcc.gnu.org/projects/cxx-status.html#cxx17
fredRos commentedon Aug 3, 2020
An example issue reported by a user
oschulz commentedon Aug 4, 2020
Yes, I agree. As for the concrete case, I guess we can just take the exception specification out?
fredRos commentedon Aug 4, 2020
I build bat with g++-9.3 and root 6.22 that sets -std=c++11 itself
So I conclude root itself doesn't build with c++17 and there is nothing gained in making BAT ready for C++17 yet. I'd rather set the c++ standard in BAT to c++11. We just didn't do this before to support even older compilers before gcc 4.8. But it's 2020 now, and I rather support existing users with modern compilers than an unknown user with a very old compiler.
I read that gcc11 will use c++17 by default, so future distros shipping that compiler would also get users into trouble if we don't specify a standard and someone used an older version root5
oschulz commentedon Aug 4, 2020
Looks like building ROOT with C++-17 compatibility may be possible, but needs special build options: https://ph-root-2.cern.ch/install/build_from_source/#building-root-with-cuda-support