Page MenuHome GnuPG

gpgme importresult.cpp fails to compile on macOS (needs to use C++14?)
Closed, ResolvedPublic

Description

% xcrun --show-sdk-version
12.3
% clang -v
Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Target: arm64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
% tar -xjf /Volumes/work/distfiles/gpgme-1.18.0.tar.bz2
% cd gpgme-1.18.0
% ./configure --prefix=/Users/tnn/test
...
checking whether g++ supports C++11 features by default... no
checking whether g++ supports C++11 features with -std=c++11... yes
...
% gmake GPG=gpg2
...
importresult.cpp:155:83: error: 'auto' not allowed in lambda parameter
            std::any_of(std::begin(d->imports), std::end(d->imports), [fpr](const auto i) {
                                                                                  ^~~~
importresult.cpp:160:71: error: 'auto' not allowed in lambda parameter
            std::any_of(std::begin(other.d->imports), it, [fpr](const auto i) {
                                  ^~~~

(many more such errors follow)

A workaround is to reconfigure with:

export CXXFLAGS="-O2 -std=c++14"
Maybe configure.ac should be bumped to require C++14? I'm no C++ standards expert ...

Details

Version
1.18.0

Event Timeline

ikloecker triaged this task as Normal priority.
ikloecker added a project: Restricted Project.

Thanks for the report! Should be fixed.

ikloecker moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.
wrobelda added a subscriber: wrobelda.

Also in:

qgpgmerefreshsmimekeysjob.cpp:97:86: error: 'auto' not allowed in lambda parameter

Thanks. QGpgME should now also compile with strict C++11. And C++14'isms shouldn't happen again unnoticed.