-
-
Notifications
You must be signed in to change notification settings - Fork 246
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 #694 from andreasfertig/papersUpdate
Added multiple test for already working papers from C++17 - 26.
- Loading branch information
Showing
14 changed files
with
218 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
template<class... Ts> | ||
struct overload : Ts... { | ||
using Ts::operator()...; | ||
}; | ||
|
||
// #B CTAD | ||
template<class... Ts> | ||
overload(Ts...) -> overload<Ts...>; | ||
|
||
int main() { | ||
overload ol{ | ||
[](int&) { }, | ||
[](char&) { }, | ||
}; | ||
} | ||
|
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,90 @@ | ||
template<class ... Ts> | ||
struct overload : public Ts... | ||
{ | ||
using Ts::operator()...; | ||
}; | ||
|
||
/* First instantiated from: p0195Test.cpp:11 */ | ||
#ifdef INSIGHTS_USE_TEMPLATE | ||
template<> | ||
struct overload<__lambda_12_7, __lambda_13_7> : public __lambda_12_7, public __lambda_13_7 | ||
{ | ||
using __lambda_12_7::operator(); | ||
// inline /*constexpr */ void ::operator()(int &) const; | ||
|
||
using __lambda_13_7::operator(); | ||
// inline /*constexpr */ void ::operator()(char &) const; | ||
|
||
// inline constexpr overload<__lambda_12_7, __lambda_13_7> & operator=(const overload<__lambda_12_7, __lambda_13_7> &) /* noexcept */ = delete; | ||
// inline constexpr overload<__lambda_12_7, __lambda_13_7> & operator=(overload<__lambda_12_7, __lambda_13_7> &&) /* noexcept */ = delete; | ||
}; | ||
|
||
#endif | ||
|
||
template<class ... Ts> | ||
overload(Ts...) -> overload<Ts...>; | ||
|
||
/* First instantiated from: p0195Test.cpp:11 */ | ||
#ifdef INSIGHTS_USE_TEMPLATE | ||
template<> | ||
overload(__lambda_12_7 __0, __lambda_13_7 __1) -> overload<__lambda_12_7, __lambda_13_7>; | ||
#endif | ||
|
||
|
||
int main() | ||
{ | ||
|
||
class __lambda_12_7 | ||
{ | ||
public: | ||
inline /*constexpr */ void operator()(int &) const | ||
{ | ||
} | ||
|
||
using retType_12_7 = void (*)(int &); | ||
inline constexpr operator retType_12_7 () const noexcept | ||
{ | ||
return __invoke; | ||
}; | ||
|
||
private: | ||
static inline /*constexpr */ void __invoke(int & __param0) | ||
{ | ||
__lambda_12_7{}.operator()(__param0); | ||
} | ||
|
||
public: | ||
// inline /*constexpr */ __lambda_12_7 & operator=(const __lambda_12_7 &) /* noexcept */ = delete; | ||
// inline /*constexpr */ __lambda_12_7(__lambda_12_7 &&) noexcept = default; | ||
|
||
}; | ||
|
||
|
||
class __lambda_13_7 | ||
{ | ||
public: | ||
inline /*constexpr */ void operator()(char &) const | ||
{ | ||
} | ||
|
||
using retType_13_7 = void (*)(char &); | ||
inline constexpr operator retType_13_7 () const noexcept | ||
{ | ||
return __invoke; | ||
}; | ||
|
||
private: | ||
static inline /*constexpr */ void __invoke(char & __param0) | ||
{ | ||
__lambda_13_7{}.operator()(__param0); | ||
} | ||
|
||
public: | ||
// inline /*constexpr */ __lambda_13_7 & operator=(const __lambda_13_7 &) /* noexcept */ = delete; | ||
// inline /*constexpr */ __lambda_13_7(__lambda_13_7 &&) noexcept = default; | ||
|
||
}; | ||
|
||
overload<__lambda_12_7, __lambda_13_7> ol = {__lambda_12_7(__lambda_12_7{}), __lambda_13_7(__lambda_13_7{})}; | ||
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,4 @@ | ||
int main() | ||
{ | ||
auto hexFloat = 0x3.ABCp-10; | ||
} |
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,5 @@ | ||
int main() | ||
{ | ||
double hexFloat = 0.0035848617553710938; | ||
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,10 @@ | ||
// cmdline:-std=c++23 | ||
|
||
#include <vector> | ||
|
||
int main() { | ||
std::vector<int> v{0, 1, 2, 3}; | ||
for (auto i = 0uz, s = v.size(); i < s; ++i) { | ||
/* use both i and v[i] */ | ||
} | ||
} |
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 @@ | ||
#include <vector> | ||
|
||
int main() | ||
{ | ||
std::vector<int, std::allocator<int> > v = std::vector<int, std::allocator<int> >{std::initializer_list<int>{0, 1, 2, 3}}; | ||
for(unsigned long i = 0UL, s = v.size(); i < s; ++i) { | ||
} | ||
|
||
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,5 @@ | ||
// cmdline:-std=c++20 | ||
|
||
struct S { | ||
int x : 8 = 42; | ||
}; |
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,5 @@ | ||
struct S | ||
{ | ||
int x:8 = 42; | ||
}; | ||
|
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,6 @@ | ||
// cmdline:-std=c++23 | ||
|
||
int x{3}; | ||
auto noSean = [s2 = x] mutable { // Currently a syntax error. | ||
++s2; | ||
}; |
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,21 @@ | ||
int x = {3}; | ||
|
||
class __lambda_4_15 | ||
{ | ||
public: | ||
inline /*constexpr */ void operator()() | ||
{ | ||
++s2; | ||
} | ||
|
||
private: | ||
int s2; | ||
|
||
public: | ||
__lambda_4_15(int & _s2) | ||
: s2{_s2} | ||
{} | ||
|
||
}; | ||
|
||
__lambda_4_15 noSean = __lambda_4_15{x}; |
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,2 @@ | ||
constexpr int N{1}; | ||
static_assert(N); |
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,2 @@ | ||
constexpr const int N = {1}; | ||
/* PASSED: static_assert(static_cast<bool>(N)); */ |
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,13 @@ | ||
// cmdline:-std=c++2b | ||
|
||
class mdspan { | ||
int field{}; | ||
public: | ||
template<class... IndexType> | ||
constexpr auto& operator[](IndexType...) { return field; } | ||
}; | ||
|
||
int main() { | ||
mdspan s{}; | ||
s[1, 1, 1] = 42; | ||
} |
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,29 @@ | ||
class mdspan | ||
{ | ||
int field; | ||
|
||
public: | ||
template<class ... IndexType> | ||
inline constexpr auto & operator[](IndexType...) | ||
{ | ||
return this->field; | ||
} | ||
|
||
#ifdef INSIGHTS_USE_TEMPLATE | ||
template<> | ||
inline constexpr int & operator[]<int, int, int>(int __0, int __1, int __2) | ||
{ | ||
return this->field; | ||
} | ||
#endif | ||
|
||
// inline constexpr mdspan() noexcept = default; | ||
}; | ||
|
||
|
||
int main() | ||
{ | ||
mdspan s = mdspan{}; | ||
s.operator[](1, 1, 1) = 42; | ||
return 0; | ||
} |