summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2014-01-14 22:03:57 +0100
committerFrancisco Jerez <[email protected]>2014-01-15 16:48:37 +0100
commitbd6266622415fd24016f5c8e47c8b9cb654ea089 (patch)
treeb6fc05d5215dfceda8b72238494dcc099e6c1d03 /src/gallium
parent5662602ba050a43a01c1e06bdfeea83ec792852e (diff)
clover: Fix clover::keys and ::values to deal with r-value references properly.
Returning a reference is incorrect if the specified pair was a temporary -- Instead of that, use decltype() to deduce the correct return type qualifiers. Fixes a crash in clCreateProgramWithBinary(). Reported-and-tested-by: "Dorrington, Albert" <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/clover/util/functional.hpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gallium/state_trackers/clover/util/functional.hpp b/src/gallium/state_trackers/clover/util/functional.hpp
index 8e0b483a78f..2d8c4c44131 100644
--- a/src/gallium/state_trackers/clover/util/functional.hpp
+++ b/src/gallium/state_trackers/clover/util/functional.hpp
@@ -289,17 +289,17 @@ namespace clover {
struct keys {
template<typename P>
- typename std::remove_reference<P>::type::first_type &
- operator()(P &&p) const {
- return p.first;
+ auto
+ operator()(P &&p) const -> decltype(std::get<0>(std::forward<P>(p))) {
+ return std::get<0>(std::forward<P>(p));
}
};
struct values {
template<typename P>
- typename std::remove_reference<P>::type::second_type &
- operator()(P &&p) const {
- return p.second;
+ auto
+ operator()(P &&p) const -> decltype(std::get<1>(std::forward<P>(p))) {
+ return std::get<1>(std::forward<P>(p));
}
};