sqlite_orm icon indicating copy to clipboard operation
sqlite_orm copied to clipboard

build error: initializer list would use explicit constructor on Linux GCC5.4

Open nmgwddj opened this issue 2 years ago • 19 comments

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())};

nmgwddj avatar Apr 18 '22 06:04 nmgwddj

are you sure that GCC5 supports C++14?

fnc12 avatar Apr 18 '22 07:04 fnc12

https://en.cppreference.com/w/cpp/compiler_support/14

nmgwddj avatar Apr 18 '22 08:04 nmgwddj

I found this answer, not sure if it's related: https://stackoverflow.com/questions/47534938/explicit-constructors-and-nested-initializer-lists

nmgwddj avatar Apr 18 '22 08:04 nmgwddj

can you test with a different GCC version?

fnc12 avatar Apr 18 '22 11:04 fnc12

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]

nmgwddj avatar Apr 19 '22 08:04 nmgwddj

I use clang, other community guys use VC++. So yes we don't have any suggestions

fnc12 avatar Apr 19 '22 09:04 fnc12

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.

trueqbit avatar Apr 26 '22 20:04 trueqbit

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.

nmgwddj avatar Apr 27 '22 01:04 nmgwddj

Latest dev branch is now testing gcc as well, so you have good chances things will work for you... Can we close the ticket?

trueqbit avatar May 11 '22 10:05 trueqbit

let's wait for @nmgwddj response first

fnc12 avatar May 11 '22 10:05 fnc12

This is full log under Linux GCC5.5 log.txt

nmgwddj avatar May 17 '22 06:05 nmgwddj

looks like you are still getting error. Is that correct?

fnc12 avatar May 22 '22 08:05 fnc12

Yes, but this time with a different error.

nmgwddj avatar May 23 '22 01:05 nmgwddj

which branch do you use? dev?

fnc12 avatar May 23 '22 03:05 fnc12

which branch do you use? dev?

Yes, in the dev branch.

nmgwddj avatar May 23 '22 07:05 nmgwddj

are you using single header or no?

fnc12 avatar May 23 '22 08:05 fnc12

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

nmgwddj avatar May 23 '22 08:05 nmgwddj

weird things. I did the same on my mac but with clang and it worked well. Can you check the same with clang?

fnc12 avatar May 23 '22 09:05 fnc12

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?

trueqbit avatar May 26 '22 06:05 trueqbit

@nmgwddj Can we close this ticket?

trueqbit avatar Mar 23 '23 11:03 trueqbit

We have upgraded gcc to 7 and temporarily closed this issue.

nmgwddj avatar Mar 23 '23 12:03 nmgwddj