-
-
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 #432 from andreasfertig/addConstevalTest
Add consteval test
- Loading branch information
Showing
5 changed files
with
124 additions
and
0 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,17 @@ | ||
// cmdline:-std=c++20 | ||
|
||
consteval bool ConstantFun() | ||
{ | ||
return true; | ||
} | ||
|
||
static_assert(ConstantFun()); | ||
|
||
struct Test { | ||
consteval bool Fun() { return true; } | ||
}; | ||
|
||
static_assert(Test{}.Fun()); | ||
|
||
static_assert([]() consteval { return true; }()); | ||
|
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,55 @@ | ||
// cmdline:-std=c++20 | ||
|
||
inline consteval bool ConstantFun() | ||
{ | ||
return true; | ||
} | ||
|
||
|
||
/* PASSED: static_assert(ConstantFun()); */ | ||
|
||
|
||
struct Test | ||
{ | ||
inline consteval bool Fun() | ||
{ | ||
return true; | ||
} | ||
|
||
}; | ||
|
||
|
||
|
||
/* PASSED: static_assert(Test{}.Fun()); */ | ||
|
||
|
||
|
||
class __lambda_16_15 | ||
{ | ||
public: | ||
inline consteval bool operator()() const | ||
{ | ||
return true; | ||
} | ||
|
||
using retType_16_15 = bool (*)(); | ||
inline /*constexpr */ operator retType_16_15 () const noexcept | ||
{ | ||
return __invoke; | ||
}; | ||
|
||
private: | ||
static inline bool __invoke() | ||
{ | ||
return true; | ||
} | ||
|
||
|
||
public: | ||
// /*constexpr */ __lambda_16_15() = default; | ||
|
||
} __lambda_16_15{}; | ||
|
||
/* PASSED: static_assert(__lambda_16_15.operator()()); */ | ||
|
||
|
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,10 @@ | ||
// cmdline:-std=c++20 | ||
|
||
template<typename T> | ||
concept C = true; | ||
|
||
auto lambda = [](C auto container) { }; | ||
|
||
int main() { | ||
lambda(4); | ||
} |
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,40 @@ | ||
// cmdline:-std=c++20 | ||
|
||
template<typename T> | ||
concept C = true; | ||
|
||
|
||
class __lambda_6_15 | ||
{ | ||
public: | ||
template<C type_parameter_0_0> | ||
inline /*constexpr */ auto operator()(type_parameter_0_0 container) const | ||
{ | ||
} | ||
|
||
#ifdef INSIGHTS_USE_TEMPLATE | ||
template<> | ||
inline /*constexpr */ void operator()(int container) const | ||
{ | ||
} | ||
#endif | ||
|
||
private: | ||
template<C type_parameter_0_0> | ||
static inline auto __invoke(type_parameter_0_0 container) | ||
{ | ||
} | ||
|
||
public: | ||
// /*constexpr */ __lambda_6_15() = default; | ||
|
||
}; | ||
|
||
__lambda_6_15 lambda = __lambda_6_15{}; | ||
|
||
|
||
int main() | ||
{ | ||
lambda.operator()(4); | ||
} | ||
|