mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
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" <albert.dorrington@lmco.com>
This commit is contained in:
parent
5662602ba0
commit
bd62666224
1 changed files with 6 additions and 6 deletions
|
|
@ -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));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue