Skip to content

Commit 643aebd

Browse files
committed
feat: add _type-id_ production for decltype
1 parent c5feb42 commit 643aebd

15 files changed

+82
-12
lines changed

regression-tests/mixed-bugfix-for-ufcs-non-local.cpp2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ d: _ == t<o.f()>(); // Fails on Clang 12 (lambda in unevaluated context).
3838

3939
u: @struct type = {
4040
b: bool == o.f();
41-
c: bool == :(x: std::type_identity_t<decltype(o.f())>) x;(true); // Fails on Clang 12 (lambda in unevaluated context).
41+
c: bool == :(x: decltype(o.f())) x;(true); // Fails on Clang 12 (lambda in unevaluated context).
4242
g: (s, sz) pre(s.sz() != 0) = { }
4343
}
4444

regression-tests/pure2-bugfix-for-non-local-function-expression.cpp2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
v: <T> concept = :() -> bool = true;();
66

7-
u: type == std::type_identity_t<decltype(:() = {})>;
7+
u: type == decltype(:() = {});
88

99
t: @struct type = {
10-
this: std::type_identity_t<decltype(:() = {})>;
10+
this: decltype(:() = {});
1111
}
1212

1313
main: () = { }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
f: () -> decltype(auto) = 0;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
x: decltype(auto) = 0;

regression-tests/pure2-last-use.cpp2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ issue_313: () = {
4242
_ = e is (e);
4343

4444
f := new<int>(0);
45-
_ = f is std::type_identity_t<decltype(f)>; // OK?
45+
_ = f is decltype(f); // OK?
4646

4747
g := new<int>(0);
4848
for (identity(g)* + identity(g)*)

regression-tests/pure2-print.cpp2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ outer: @print type = {
100100
all: <Args...: type> (args...: Args) -> bool =
101101
(... && args);
102102

103+
y: (_: decltype(0)) = { }
104+
103105
}
104106

105107
main: () = {

regression-tests/test-results/mixed-bugfix-for-ufcs-non-local.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ auto g() -> void{
9595

9696
#line 40 "mixed-bugfix-for-ufcs-non-local.cpp2"
9797
inline CPP2_CONSTEXPR bool u::b{ CPP2_UFCS_NONLOCAL(f)(o) };
98-
inline CPP2_CONSTEXPR bool u::c{ [](cpp2::impl::in<std::type_identity_t<decltype(CPP2_UFCS_NONLOCAL(f)(o))>> x) -> auto { return x; }(true) };// Fails on Clang 12 (lambda in unevaluated context).
98+
inline CPP2_CONSTEXPR bool u::c{ [](cpp2::impl::in<decltype(CPP2_UFCS_NONLOCAL(f)(o))> x) -> auto { return x; }(true) };// Fails on Clang 12 (lambda in unevaluated context).
9999
auto u::g(auto const& s, auto const& sz) -> void{
100100
if (cpp2::cpp2_default.is_active() && !(CPP2_UFCS(sz)(s) != 0) ) { cpp2::cpp2_default.report_violation(""); }}
101101

regression-tests/test-results/pure2-bugfix-for-non-local-function-expression.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ class t;
2222
#line 5 "pure2-bugfix-for-non-local-function-expression.cpp2"
2323
template<typename T> concept v = []() -> bool { return true; }();
2424

25-
using u = std::type_identity_t<decltype([]() -> void{})>;
25+
using u = decltype([]() -> void{});
2626

27-
class t: public std::type_identity_t<decltype([]() -> void{})> {
27+
class t: public decltype([]() -> void{}) {
2828

2929
};
3030

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pure2-deduction-1-error.cpp2...
2+
pure2-deduction-1-error.cpp2(1,10): error: decltype(auto) is not needed in Cpp2 - use 'forward: _' parameters/returns/objects instead
3+
(temporary alpha limitation) returns means auto&&
4+
(temporary alpha limitation) objects are not yet supported
5+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pure2-deduction-2-error.cpp2...
2+
pure2-deduction-2-error.cpp2(1,4): error: decltype(auto) is not needed in Cpp2 - use 'forward: _' parameters/returns/objects instead
3+
(temporary alpha limitation) returns means auto&&
4+
(temporary alpha limitation) objects are not yet supported
5+

0 commit comments

Comments
 (0)