-
-
Notifications
You must be signed in to change notification settings - Fork 240
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 #575 from andreasfertig/fixIssue506
Fixed #506: Show suffixes for `ParmVarDecl` if it is a parameter pack.
- Loading branch information
Showing
6 changed files
with
127 additions
and
5 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,14 @@ | ||
#include <cstdio> | ||
#include <iostream> | ||
#include <cctype> | ||
|
||
template<class...Match> | ||
bool search(char ch, Match&&...matchers) { | ||
return (matchers(ch) || ...); | ||
} | ||
|
||
int main() | ||
{ | ||
std::cout << search('A', ::isalpha, ::isdigit, [](char ch) { return ch == '_'; }); | ||
} | ||
|
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,52 @@ | ||
#include <cstdio> | ||
#include <iostream> | ||
#include <cctype> | ||
|
||
template<class ... Match> | ||
bool search(char ch, Match &&... matchers) | ||
{ | ||
return (matchers(ch) || ...); | ||
} | ||
|
||
|
||
/* First instantiated from: Issue506.cpp:12 */ | ||
#ifdef INSIGHTS_USE_TEMPLATE | ||
template<> | ||
bool search<int (&)(int), int (&)(int), __lambda_12_50>(char ch, int (&__matchers1)(int), int (&__matchers2)(int), __lambda_12_50 && __matchers3) | ||
{ | ||
return static_cast<bool>(__matchers1(static_cast<int>(ch))) || (static_cast<bool>(__matchers2(static_cast<int>(ch))) || __matchers3.operator()(ch)); | ||
} | ||
#endif | ||
|
||
|
||
int main() | ||
{ | ||
|
||
class __lambda_12_50 | ||
{ | ||
public: | ||
inline /*constexpr */ bool operator()(char ch) const | ||
{ | ||
return static_cast<int>(ch) == static_cast<int>('_'); | ||
} | ||
|
||
using retType_12_50 = bool (*)(char); | ||
inline constexpr operator retType_12_50 () const noexcept | ||
{ | ||
return __invoke; | ||
}; | ||
|
||
private: | ||
static inline /*constexpr */ bool __invoke(char ch) | ||
{ | ||
return __lambda_12_50{}.operator()(ch); | ||
} | ||
|
||
|
||
}; | ||
|
||
std::cout.operator<<(search('A', ::isalpha, ::isdigit, __lambda_12_50{})); | ||
return 0; | ||
} | ||
|
||
|
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,16 @@ | ||
bool Fun(char) | ||
{ | ||
return false; | ||
} | ||
|
||
template<class...Match> | ||
bool search(char ch, Match&&...matchers) { | ||
return (matchers(ch) || ...); | ||
} | ||
|
||
int main() | ||
{ | ||
// std::cout << search('A', ::isalpha, ::isdigit, [](char ch) { return ch == '_'; }); | ||
// return search('A', Fun, Fun, [](char ch) { return ch == '_'; }); | ||
return search('A', Fun); | ||
} |
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,28 @@ | ||
bool Fun(char) | ||
{ | ||
return false; | ||
} | ||
|
||
|
||
template<class ... Match> | ||
bool search(char ch, Match &&... matchers) | ||
{ | ||
return (matchers(ch) || ...); | ||
} | ||
|
||
|
||
/* First instantiated from: Issue506_2.cpp:15 */ | ||
#ifdef INSIGHTS_USE_TEMPLATE | ||
template<> | ||
bool search<bool (&)(char)>(char ch, bool (&__matchers1)(char)) | ||
{ | ||
return __matchers1(ch); | ||
} | ||
#endif | ||
|
||
|
||
int main() | ||
{ | ||
return static_cast<int>(search('A', Fun)); | ||
} | ||
|
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