Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/modules/RootConfiguration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ else()
endif()

CHECK_CXX_SOURCE_COMPILES("#include <tuple>
int main() { std::tuple<int> tup;std::apply(tup, [](int){}); return 0;}" found_stdapply)
int main() { std::apply([](int, int){}, std::make_tuple(1,2)); return 0;}" found_stdapply)
if(found_stdapply)
set(hasstdapply define)
else()
Expand Down
2 changes: 2 additions & 0 deletions core/base/v7/inc/ROOT/impl_tuple_apply.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ decltype(auto) invoke(F&& f, ArgTypes&&... args) {
}
#endif // ndef R__HAS_STD_INVOKE

#ifndef R__HAS_STD_APPLY
// From http://en.cppreference.com/w/cpp/experimental/apply
namespace detail {
template<class F, class Tuple, std::size_t... I>
Expand All @@ -82,6 +83,7 @@ constexpr decltype(auto) apply(F &&f, Tuple &&t) {
std::make_index_sequence < std::tuple_size <
std::decay_t < Tuple >> {} > {});
}
#endif // ndef R__HAS_STD_APPLY
} // namespace __ROOT
} // namespace std

Expand Down
1 change: 1 addition & 0 deletions hist/hist/v7/inc/ROOT/THistImpl.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define ROOT7_THistImpl

#include <cctype>
#include <functional>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, David!

#include "ROOT/RArrayView.hxx"
#include "ROOT/RTupleApply.hxx"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,11 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
else if (!LangOpts.GNUMode && LangOpts.Digraphs)
Builder.defineMacro("__STDC_VERSION__", "199409L");
} else {
// FIXME: Use correct value for C++17.
// C++17 [cpp.predefined]p1:
// The name __cplusplus is defined to the value 201703L when compiling a
// C++ translation unit.
if (LangOpts.CPlusPlus1z)
Builder.defineMacro("__cplusplus", "201406L");
Builder.defineMacro("__cplusplus", "201703L");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to match clang value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no real need. The compiler will not care as it's not using this value. Clang 3.9 which is embedded in ROOT already supported majority of C++17 features. Changing __cplusplus to a proper value does not mean that C++17 is out experimental land. This is basically for people who use __cplusplus to figure out what C++ features they want to use.

// C++1y [cpp.predefined]p1:
// The name __cplusplus is defined to the value 201402L when compiling a
// C++ translation unit.
Expand Down