Skip to content

Commit

Permalink
fix(to_cpp1): consider that postfix tem can be empty
Browse files Browse the repository at this point in the history
  • Loading branch information
JohelEGP committed Nov 28, 2023
1 parent ebe9405 commit b9b5592
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
2 changes: 2 additions & 0 deletions regression-tests/pure2-bugfix-for-dependent-types.cpp2
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,6 @@ main: () = {
_ = :alias::value_type = 0; // Non-dependent.
}
}(0);

_ = :(r) -> std::type_identity_t<decltype(begin(r)*)> = r[0];(std::vector<int>(1));
}
2 changes: 1 addition & 1 deletion regression-tests/test-results/gcc-13/gcc-version.output
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
gcc (GCC) 13.2.1 20231011 (Red Hat 13.2.1-4)
c++ (GCC) 13.2.1 20230801
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
pure2-bugfix-for-dependent-types-recursion.cpp: In function ‘int main()’:
pure2-bugfix-for-dependent-types-recursion.cpp:19:13: error: ‘b’ does not name a type
19 | using a = b;
pure2-bugfix-for-dependent-types-recursion.cpp2: In function ‘int main()’:
pure2-bugfix-for-dependent-types-recursion.cpp2:2:13: error: ‘b’ does not name a type
2 | a: type == b;
| ^
pure2-bugfix-for-dependent-types-recursion.cpp:20:13: error: ‘a’ does not name a type
20 | using b = a;
pure2-bugfix-for-dependent-types-recursion.cpp2:3:13: error: ‘a’ does not name a type
3 | b: type == a;
| ^
pure2-bugfix-for-dependent-types-recursion.cpp:21:21: error: ‘a’ has not been declared
21 | static_cast<void>(a::t);
pure2-bugfix-for-dependent-types-recursion.cpp2:4:21: error: ‘a’ has not been declared
4 | _ = a::t;
| ^
pure2-bugfix-for-dependent-types-recursion.cpp:22:21: error: ‘b’ has not been declared
22 | static_cast<void>(b::t);
pure2-bugfix-for-dependent-types-recursion.cpp2:5:21: error: ‘b’ has not been declared
5 | _ = b::t;
| ^
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,7 @@ auto main() -> int{
static_cast<void>(typename alias::value_type{0});// Non-dependent.
}
}(0));

static_cast<void>([](auto const& r) -> std::type_identity_t<decltype(*cpp2::assert_not_null(begin(r)))> { return CPP2_ASSERT_IN_BOUNDS(r, 0); }(std::vector<int>(1)));
}

4 changes: 3 additions & 1 deletion source/to_cpp1.h
Original file line number Diff line number Diff line change
Expand Up @@ -1947,8 +1947,10 @@ class cppfront
{
if (expr.id_expr) {
return (*this)(*expr.id_expr);
} else if (expr.expr_list) {
return (*this)(*expr.expr_list);
}
return (*this)(*expr.expr_list);
return false;
}

auto operator()(primary_expression_node const& expr) const
Expand Down

0 comments on commit b9b5592

Please sign in to comment.