Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error with GCC 5.5.0: expression '<throw-expression>' is not a constant-expression #682

Closed
akien-mga opened this issue Mar 15, 2018 · 2 comments

Comments

@akien-mga
Copy link

akien-mga commented Mar 15, 2018

  • OS: Mageia 6 x86_64 (Linux)
  • Toolchain: GCC 5.5.0, CMake 3.10.2
  • fmt commit: 70dffc6

Building with the following command, I get an error:

$ mkdir build && cd build
$ cmake ..
-- CMake version: 3.10.2
-- The C compiler identification is GNU 5.5.0
-- The CXX compiler identification is GNU 5.5.0
-- Check for working C compiler: /bin/cc
-- Check for working C compiler: /bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /bin/c++
-- Check for working CXX compiler: /bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Version: 5.0.0
-- Build type: Release
-- Performing Test HAVE_STD_CPP14_FLAG
-- Performing Test HAVE_STD_CPP14_FLAG - Success
-- Performing Test FMT_CPP14_CMATH
-- Performing Test FMT_CPP14_CMATH - Success
-- Performing Test FMT_CPP14_UNISTD_H
-- Performing Test FMT_CPP14_UNISTD_H - Success
-- Performing Test FMT_CPP14_SNPRINTF
-- Performing Test FMT_CPP14_SNPRINTF - Success
-- CPP14_FLAG: -std=c++14
-- Performing Test SUPPORTS_VARIADIC_TEMPLATES
-- Performing Test SUPPORTS_VARIADIC_TEMPLATES - Success
-- Performing Test SUPPORTS_INITIALIZER_LIST
-- Performing Test SUPPORTS_INITIALIZER_LIST - Success
-- Performing Test SUPPORTS_ENUM_BASE
-- Performing Test SUPPORTS_ENUM_BASE - Success
-- Performing Test SUPPORTS_TYPE_TRAITS
-- Performing Test SUPPORTS_TYPE_TRAITS - Success
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS - Success
-- Looking for open
-- Looking for open - found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Performing Test HAVE_FNO_DELETE_NULL_POINTER_CHECKS
-- Performing Test HAVE_FNO_DELETE_NULL_POINTER_CHECKS - Success
-- Performing Test HAVE_FNO_EXCEPTIONS_FLAG
-- Performing Test HAVE_FNO_EXCEPTIONS_FLAG - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /home/akien/tmp/citra/fmt/build
$ make
Scanning dependencies of target fmt
[  2%] Building CXX object CMakeFiles/fmt.dir/include/fmt/posix.cc.o
[  4%] Building CXX object CMakeFiles/fmt.dir/include/fmt/format.cc.o
[  7%] Linking CXX static library libfmt.a
[  7%] Built target fmt
Scanning dependencies of target gmock
[  9%] Building CXX object test/CMakeFiles/gmock.dir/gmock-gtest-all.cc.o
[ 12%] Linking CXX static library libgmock.a
[ 12%] Built target gmock
Scanning dependencies of target test-main
[ 14%] Building CXX object test/CMakeFiles/test-main.dir/test-main.cc.o
[ 17%] Building CXX object test/CMakeFiles/test-main.dir/gtest-extra.cc.o
[ 19%] Building CXX object test/CMakeFiles/test-main.dir/util.cc.o
[ 21%] Linking CXX static library libtest-main.a
[ 21%] Built target test-main
Scanning dependencies of target time-test
[ 24%] Building CXX object test/CMakeFiles/time-test.dir/time-test.cc.o
[ 26%] Linking CXX executable ../bin/time-test
[ 26%] Built target time-test
Scanning dependencies of target ostream-test
[ 29%] Building CXX object test/CMakeFiles/ostream-test.dir/ostream-test.cc.o
[ 31%] Linking CXX executable ../bin/ostream-test
[ 31%] Built target ostream-test
Scanning dependencies of target format-impl-test
[ 34%] Building CXX object test/CMakeFiles/format-impl-test.dir/format-impl-test.cc.o
In file included from /home/akien/tmp/citra/fmt/test/format-impl-test.cc:10:0:
/home/akien/tmp/citra/fmt/include/fmt/core.h: In function 'constexpr bool fmt::internal::is_integral(fmt::internal::type)':
/home/akien/tmp/citra/fmt/test/test-assert.h:19:51: error: expression '<throw-expression>' is not a constant-expression
   if (!(condition)) throw AssertionFailure(message);
                                                   ^
/home/akien/tmp/citra/fmt/include/fmt/core.h:442:3: note: in expansion of macro 'FMT_ASSERT'
   FMT_ASSERT(t != internal::name_arg_type, "invalid argument type");
   ^
/home/akien/tmp/citra/fmt/include/fmt/core.h: In function 'constexpr bool fmt::internal::is_arithmetic(fmt::internal::type)':
/home/akien/tmp/citra/fmt/test/test-assert.h:19:51: error: expression '<throw-expression>' is not a constant-expression
   if (!(condition)) throw AssertionFailure(message);
                                                   ^
/home/akien/tmp/citra/fmt/include/fmt/core.h:447:3: note: in expansion of macro 'FMT_ASSERT'
   FMT_ASSERT(t != internal::name_arg_type, "invalid argument type");
   ^
test/CMakeFiles/format-impl-test.dir/build.make:62: recipe for target 'test/CMakeFiles/format-impl-test.dir/format-impl-test.cc.o' failed
make[2]: *** [test/CMakeFiles/format-impl-test.dir/format-impl-test.cc.o] Error 1
CMakeFiles/Makefile2:280: recipe for target 'test/CMakeFiles/format-impl-test.dir/all' failed
make[1]: *** [test/CMakeFiles/format-impl-test.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2

It builds fine on the same system with Clang 3.9.1.

@akien-mga
Copy link
Author

fmt 4.1.0 builds fine on the same system with GCC 5.5.0 and Clang 3.9.1.

vitaut added a commit that referenced this issue Mar 16, 2018
@vitaut
Copy link
Contributor

vitaut commented Mar 16, 2018

This is due to GCC bug 67371. Implemented a workaround in 505b3ae. Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants