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

Fixes compilation error on std=gnu++14 #62

Closed
wants to merge 1 commit into from

Conversation

erikwijmans
Copy link
Contributor

Motivation and Context

On std=gnu++14, I get the following compile error:

[30/10/44  11% :: 8.5] Building CXX object src/Corrade/PluginManager/CMakeFiles/CorradePluginManagerObjects.dir/AbstractPlugin.cpp.o
FAILED: src/Corrade/PluginManager/CMakeFiles/CorradePluginManagerObjects.dir/AbstractPlugin.cpp.o
/Library/Developer/CommandLineTools/usr/bin/c++  -DCorradePluginManagerObjects_EXPORTS -I../src -Isrc -std=gnu++14 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -fPIC   -Wall -Wextra -Wold-style-cast -Winit-self -Werror=return-type -Wmissing-declarations -pedantic -fvisibility=hidden -Wmissing-prototypes -Wno-shorten-64-to-32 -MD -MT src/Corrade/PluginManager/CMakeFiles/CorradePluginManagerObjects.dir/AbstractPlugin.cpp.o -MF src/Corrade/PluginManager/CMakeFiles/CorradePluginManagerObjects.dir/AbstractPlugin.cpp.o.d -o src/Corrade/PluginManager/CMakeFiles/CorradePluginManagerObjects.dir/AbstractPlugin.cpp.o -c ../src/Corrade/PluginManager/AbstractPlugin.cpp
In file included from ../src/Corrade/PluginManager/AbstractPlugin.cpp:26:
In file included from ../src/Corrade/PluginManager/AbstractPlugin.h:32:
../src/Corrade/Containers/Pointer.h:118:123: error: chosen constructor is explicit in copy-initialization
        template<class ...Args> explicit Pointer(InPlaceInitT, Args&&... args): _pointer{new T{std::forward<Args>(args)...}} {}
                                                                                                                          ^
../src/Corrade/PluginManager/AbstractPlugin.cpp:51:35: note: in instantiation of function template specialization 'Corrade::Containers::Pointer<Corrade::PluginManager::AbstractPlugin::State>::Pointer<>' requested here
AbstractPlugin::AbstractPlugin(): _state{Containers::InPlaceInit} {}
                                  ^
../src/Corrade/Utility/ConfigurationGroup.h:59:18: note: explicit constructor declared here
        explicit ConfigurationGroup();
                 ^
../src/Corrade/PluginManager/AbstractPlugin.cpp:38:33: note: in implicit initialization of field 'configuration' with omitted initializer
    Utility::ConfigurationGroup configuration;
                                ^
1 error generated.
[30/1/44  31% :: 10.3] Building CXX object src/Corrade/TestSuite/CMakeFiles/CorradeTestSuite.dir/Tester.cpp.o
ninja: build stopped: subcommand failed.

This PR explicitly initializes configuration, fixing this error. On this PR, I can successfully build corrade (and all of magnum for that matter) with std=gnu++14

How to repro

mkdir build && cd build
cmake -DCMAKE_CXX_FLAGS="-std=gnu++14" ..
make

@mosra
Copy link
Owner

mosra commented Apr 22, 2019

Hi, thank you!

One very weird request before I am able to look at this -- there's this very nasty security feature bug in Travis CI where if you set it up for your fork on travis-ci.com while I have it for my repo on travis-ci.org, I will stop getting notifications on my own builds and start getting notifications from your builds instead, like this:

image

(Also note there are no Travis checks displayed below this PR.) The only solution to this I know is either:

  • if you either fully remove the Travis setup for Corrade from your travis-ci.com account
  • or you remove it from travis-ci.com and set it up on travis-ci.org instead

This is a very nasty bug, sorry about the inconvenience. I didn't have the nerve to report it to Travis themselves because their issue tracker is the worst.

@codecov-io
Copy link

codecov-io commented Apr 22, 2019

Codecov Report

Merging #62 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #62      +/-   ##
==========================================
+ Coverage   97.63%   97.63%   +<.01%     
==========================================
  Files          80       80              
  Lines        5233     5234       +1     
==========================================
+ Hits         5109     5110       +1     
  Misses        124      124
Impacted Files Coverage Δ
src/Corrade/PluginManager/AbstractPlugin.cpp 75.86% <100%> (+0.86%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6695269...db5dd69. Read the comment docs.

@mosra mosra added this to TODO in Platforms via automation Apr 23, 2019
@mosra mosra added this to the 2019.0b milestone Apr 23, 2019
@mosra
Copy link
Owner

mosra commented Apr 23, 2019

Merged as 8270822, thank you! While testing locally, this happened only with Clang, GCC 8.2 with -std=gnu++14 had no problem with the original code.

@mosra mosra closed this Apr 23, 2019
Platforms automation moved this from TODO to Done Apr 23, 2019
@erikwijmans erikwijmans deleted the cpp14-fix branch April 23, 2019 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Platforms
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants