sqlite_orm
sqlite_orm copied to clipboard
build error: initializer list would use explicit constructor on Linux GCC5.4
Build environment: System: Linux x86_64 Compiler: GCC5 C++ STD: 14
error message:
include/sqlite_orm/sqlite_orm.h:6835:45: error: converting to 'std::tuple<const char*, int>' from initializer list would use explicit constructor 'constexpr std::tuple<_T1, _T2>::tuple(_U1&&, _U2&&) [with _U1 = const char*; _U2 = int; <template-parameter-2-3> = void; _T1 = const char*; _T2 = int]'
return {s.c_str(), int(s.size())};
are you sure that GCC5 supports C++14?
https://en.cppreference.com/w/cpp/compiler_support/14
I found this answer, not sure if it's related: https://stackoverflow.com/questions/47534938/explicit-constructors-and-nested-initializer-lists
can you test with a different GCC version?
can you test with a different GCC version?
Compiled successfully with gcc7 under Linux. But we may have to adapt to gcc5. I don't know if you have any suggestions for this. I can try to modify it locally for testing.
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Debug
compiler=gcc
compiler.cppstd=14
compiler.libcxx=libstdc++11
compiler.version=7
os=Linux
os_build=Linux
[options]
[build_requires]
[env]
I use clang, other community guys use VC++. So yes we don't have any suggestions
sqlite_orm 1.7.1 is using a C++17 library feature here - see compiler support matrix entry on Improving std::pair and std::tuple [N4387]. The current dev branch is using a std::pair instead of std::tuple, which doesn't exhibit this problem, see also a test project on godbolt.
sqlite_orm 1.7.1 is using a C++17 library feature here - see compiler support matrix entry on Improving std::pair and std::tuple [N4387]. The current dev branch is using a std::pair instead of std::tuple, which doesn't exhibit this problem, see also a test project on godbolt.
Thanks for your reply. I will try develop branch.
Latest dev branch is now testing gcc as well, so you have good chances things will work for you... Can we close the ticket?
let's wait for @nmgwddj response first
This is full log under Linux GCC5.5 log.txt
looks like you are still getting error. Is that correct?
Yes, but this time with a different error.
which branch do you use? dev
?
which branch do you use?
dev
?
Yes, in the dev
branch.
are you using single header or no?
I just switch the code to the dev branch and execute the following two CMake commands:
cmake -Bbuild -DCMAKE_BUILD_TYPE=Debug
# build
cmake --build build --config Debug
weird things. I did the same on my mac but with clang and it worked well. Can you check the same with clang?
The error log that you attached is very strange:
error: ‘connection_ref’ does not name a type: connection_ref con;
The corresponding header file has been correctly included long before. Could you try the unmerged headers from not_single_header_include/sqlite_orm and find out why gcc 5 does not work?
@nmgwddj Can we close this ticket?
We have upgraded gcc to 7 and temporarily closed this issue.