-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix std::make_unique compilation errors on Windows #1151
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
Fix std::make_unique compilation errors on Windows #1151
Conversation
This fixes the following errors:
```
TRootDS.cxx(145): error C2668: 'std::make_unique': ambiguous call to overloaded function [TreePlayer.vcxproj]
C:\Users\bellenot\build\master-check\include\ROOT/RMakeUnique.hxx(26): note: could be 'std::unique_ptr<ROOT::Experimental::TDF::TRootDS,std::default_delete<_Ty>> std::make_unique<ROOT::Experimental::TDF::TRootDS,std::string_view&,std::string_view&>(std::string_view &,std::string_view &)'
with
[
_Ty=ROOT::Experimental::TDF::TRootDS
]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\include\memory(2436): note:
or 'std::unique_ptr<ROOT::Experimental::TDF::TRootDS,std::default_delete<_Ty>> std::make_unique<ROOT::Experimental::TDF::TRootDS,std::string_view&,std::string_view&,void>(std::string_view &,std::string_view &)'
with
[
_Ty=ROOT::Experimental::TDF::TRootDS
]
TRootDS.cxx(145): note: while trying to match the argument list '(std::string_view, std::string_view)'
TRootDS.cxx(145): error C2512: 'ROOT::Experimental::TDataFrame::TDataFrame': no appropriate default constructor available [TreePlayer.vcxproj]
TTrivialDS.cxx
TTrivialDS.cxx(82): error C2668: 'std::make_unique': ambiguous call to overloaded function [TreePlayer.vcxproj]
C:\Users\bellenot\build\master-check\include\ROOT/RMakeUnique.hxx(26): note: could be 'std::unique_ptr<ROOT::Experimental::TDF::TTrivialDS,std::default_delete<_Ty>> std::make_unique<ROOT::Experimental::TDF::TTrivialDS,ULong64_t&>(ULong64_t &)'
with
[
_Ty=ROOT::Experimental::TDF::TTrivialDS
]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\include\memory(2436): note:
or 'std::unique_ptr<ROOT::Experimental::TDF::TTrivialDS,std::default_delete<_Ty>> std::make_unique<ROOT::Experimental::TDF::TTrivialDS,ULong64_t&,void>(ULong64_t &)'
with
[
_Ty=ROOT::Experimental::TDF::TTrivialDS
]
TTrivialDS.cxx(82): note: while trying to match the argument list '(ULong64_t)'
TTrivialDS.cxx(82): error C2512: 'ROOT::Experimental::TDataFrame::TDataFrame': no appropriate default constructor available [TreePlayer.vcxproj]
```
|
Starting build on |
tree/treeplayer/src/TRootDS.cxx
Outdated
| ROOT::Experimental::TDataFrame tdf(std::unique_ptr<TRootDS>(new TRootDS(treeName, fileNameGlob))); | ||
| #else | ||
| ROOT::Experimental::TDataFrame tdf(std::make_unique<TRootDS>(treeName, fileNameGlob)); | ||
| #endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have the feeling this ifdef clutters the code a bit. It's a compiler bug workaround.
If it's not possible to fix the make_unique template, I would propose to remove the ifdef, move to the unique_ptr ctor and add a clear comment stating that make_unique does not work yet on windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, I think I found the origin of the problem...
|
Starting build on |
This fixes the following errors: