Skip to content

Commit

Permalink
fix(parse): permit unbraced function expression as template argument
Browse files Browse the repository at this point in the history
  • Loading branch information
JohelEGP committed Oct 31, 2023
1 parent 96cf605 commit c74208f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@

#define CPP2_USE_MODULES Yes
#define CPP2_IMPORT_STD Yes

//=== Cpp2 type declarations ====================================================


#include "cpp2util.h"

#line 1 "pure2-bugfix-for-unbraced-function-expression.cpp2"
class t;


//=== Cpp2 type definitions and function declarations ===========================

#line 1 "pure2-bugfix-for-unbraced-function-expression.cpp2"
class t {
public: auto operator[](auto const& f) const -> void;
public: auto operator[](auto const& f) const& -> void;

public: t() = default;
public: t(t const&) = delete; /* No 'that' constructor, suppress copy */
Expand All @@ -28,7 +26,7 @@ class t {


#line 2 "pure2-bugfix-for-unbraced-function-expression.cpp2"
auto t::operator[](auto const& f) const -> void{}
auto t::operator[](auto const& f) const& -> void{}

[[nodiscard]] auto main() -> int{
{
Expand Down
1 change: 1 addition & 0 deletions source/parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -5364,6 +5364,7 @@ class parser
&& curr().type() != lexeme::LeftParen // not imediatelly called
&& curr().type() != lexeme::RightParen // not as a last argument to function
&& curr().type() != lexeme::Comma // not as first or in-the-middle, function argument
&& curr().type() != lexeme::Greater // not as the last argument to template
&& curr().type() != lexeme::RightBracket // not as the last index argument
&& curr() != "is" // not as the argument to is
&& curr() != "as" // not as the argument to as
Expand Down

0 comments on commit c74208f

Please sign in to comment.