forked from hsutter/cppfront
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cpp1): emit requires clause in forward declaration (hsutter#486)
* fix(cpp1): emit requires clause in forward declaration * refactor: prevent warning on token-eating macro Co-authored-by: Max Sagebaum <[email protected]> Signed-off-by: Johel Ernesto Guerrero Peña <[email protected]> * test: add `test-results/gcc-13` * Delete gcc-version.output Signed-off-by: Herb Sutter <[email protected]> --------- Signed-off-by: Johel Ernesto Guerrero Peña <[email protected]> Signed-off-by: Herb Sutter <[email protected]> Co-authored-by: Max Sagebaum <[email protected]> Co-authored-by: Herb Sutter <[email protected]>
- Loading branch information
Showing
11 changed files
with
128 additions
and
54 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
5 changes: 5 additions & 0 deletions
5
regression-tests/pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2
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 @@ | ||
element: type = { | ||
name: std::string; | ||
operator=: (out this, forward n: std::string) = { name = n; } | ||
} | ||
main: () = { } |
Empty file.
Empty file.
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
55 changes: 55 additions & 0 deletions
55
regression-tests/test-results/pure2-bugfix-for-requires-clause-in-forward-declaration.cpp
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 @@ | ||
|
||
#define CPP2_USE_MODULES Yes | ||
|
||
//=== Cpp2 type declarations ==================================================== | ||
|
||
|
||
#include "cpp2util.h" | ||
|
||
#line 1 "pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2" | ||
class element; | ||
|
||
|
||
//=== Cpp2 type definitions and function declarations =========================== | ||
|
||
#line 1 "pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2" | ||
class element { | ||
private: std::string name; | ||
public: explicit element(auto&& n) | ||
CPP2_REQUIRES (std::is_same_v<CPP2_TYPEOF(n), std::string>) | ||
#line 3 "pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2" | ||
; | ||
#line 3 "pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2" | ||
public: auto operator=(auto&& n) -> element& | ||
CPP2_REQUIRES (std::is_same_v<CPP2_TYPEOF(n), std::string>) | ||
#line 3 "pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2" | ||
; | ||
|
||
public: element(element const&) = delete; /* No 'that' constructor, suppress copy */ | ||
public: auto operator=(element const&) -> void = delete; | ||
#line 4 "pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2" | ||
}; | ||
auto main() -> int; | ||
|
||
|
||
//=== Cpp2 function definitions ================================================= | ||
|
||
|
||
#line 3 "pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2" | ||
element::element(auto&& n) | ||
requires (std::is_same_v<CPP2_TYPEOF(n), std::string>) | ||
: name{ CPP2_FORWARD(n) } | ||
#line 3 "pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2" | ||
{} | ||
#line 3 "pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2" | ||
auto element::operator=(auto&& n) -> element& | ||
requires (std::is_same_v<CPP2_TYPEOF(n), std::string>) | ||
#line 3 "pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2" | ||
{ | ||
name = CPP2_FORWARD(n); | ||
return *this; | ||
#line 3 "pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2" | ||
} | ||
|
||
auto main() -> int{} | ||
|
2 changes: 2 additions & 0 deletions
2
...on-tests/test-results/pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2.output
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 @@ | ||
pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2... ok (all Cpp2, passes safety checks) | ||
|
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
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