-
-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #590 from andreasfertig/fixIssue492
Fixed #492: Correctly handle lambda in `decltype`.
- Loading branch information
Showing
5 changed files
with
137 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// cmdline:-std=c++20 | ||
|
||
#include <queue> | ||
#include <vector> | ||
|
||
void f() | ||
{ | ||
std::priority_queue<int, | ||
std::vector<int>, | ||
decltype([](int lhs, int rhs) { return lhs > rhs; })> min_heap; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// cmdline:-std=c++20 | ||
|
||
#include <queue> | ||
#include <vector> | ||
|
||
void f() | ||
{ | ||
|
||
class __lambda_10_34 | ||
{ | ||
public: | ||
inline /*constexpr */ bool operator()(int lhs, int rhs) const | ||
{ | ||
return lhs > rhs; | ||
} | ||
|
||
using retType_10_34 = bool (*)(int, int); | ||
inline constexpr operator retType_10_34 () const noexcept | ||
{ | ||
return __invoke; | ||
}; | ||
|
||
private: | ||
static inline /*constexpr */ bool __invoke(int lhs, int rhs) | ||
{ | ||
return __lambda_10_34{}.operator()(lhs, rhs); | ||
} | ||
|
||
public: | ||
// /*constexpr */ __lambda_10_34() = default; | ||
|
||
}; | ||
|
||
std::priority_queue<int, std::vector<int, std::allocator<int> >, __lambda_10_34> min_heap = std::priority_queue<int, std::vector<int, std::allocator<int> >, __lambda_10_34>(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// cmdline:-std=c++20 | ||
|
||
template< | ||
class T, | ||
class Container, | ||
class _Compare | ||
> class priority_queue | ||
{ | ||
public: | ||
priority_queue(){} | ||
}; | ||
|
||
|
||
void f() | ||
{ | ||
priority_queue<int, | ||
float, | ||
decltype([]() { return false; })> min_heap; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// cmdline:-std=c++20 | ||
|
||
template<class T, class Container, class _Compare> | ||
class priority_queue | ||
{ | ||
|
||
public: | ||
inline priority_queue() | ||
{ | ||
} | ||
|
||
}; | ||
|
||
/* First instantiated from: Issue492_2.cpp:18 */ | ||
#ifdef INSIGHTS_USE_TEMPLATE | ||
template<> | ||
class priority_queue<int, float, __lambda_18_34> | ||
{ | ||
|
||
public: | ||
inline priority_queue() | ||
{ | ||
} | ||
|
||
}; | ||
|
||
#endif | ||
|
||
|
||
|
||
void f() | ||
{ | ||
|
||
class __lambda_18_34 | ||
{ | ||
public: | ||
inline /*constexpr */ bool operator()() const | ||
{ | ||
return false; | ||
} | ||
|
||
using retType_18_34 = bool (*)(); | ||
inline constexpr operator retType_18_34 () const noexcept | ||
{ | ||
return __invoke; | ||
}; | ||
|
||
private: | ||
static inline /*constexpr */ bool __invoke() | ||
{ | ||
return __lambda_18_34{}.operator()(); | ||
} | ||
|
||
|
||
public: | ||
// /*constexpr */ __lambda_18_34() = default; | ||
|
||
}; | ||
|
||
priority_queue<int, float, __lambda_18_34> min_heap = priority_queue<int, float, __lambda_18_34>(); | ||
} | ||
|
||
|