-
Notifications
You must be signed in to change notification settings - Fork 225
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 correct UFCS in function signature
- Loading branch information
Showing
14 changed files
with
148 additions
and
32 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,25 @@ | ||
template<bool> struct t { }; | ||
constexpr bool f(const t<true>&) { return true; } | ||
constexpr t<true> o{}; | ||
|
||
// Variables. | ||
|
||
// _: <V: t<o.f()>> bool = (); // Blocked on #389, [GCC109781][]. | ||
|
||
_: t<o.f()> = (); | ||
|
||
_: bool = o.f(); | ||
|
||
// Functions. | ||
|
||
// g: <V: t<o.f()>> () = { } // Blocked on [GCC109781][]. | ||
|
||
g: (x: t<o.f()>) = { } | ||
|
||
g: () [[pre: o.f()]] = { } | ||
|
||
h: () -> t<o.f()> = o; | ||
|
||
main: () = { } | ||
|
||
// [GCC109781]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109781 |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
f: <T> () -> std::type_identity_t<decltype(T().a())> = { } | ||
B: type = { } | ||
main: () = { | ||
static_assert(!std::invocable<decltype(:<T> (x: T) -> std::void_t<decltype(f<T>())> = {}), B>); | ||
} |
File renamed without changes.
File renamed without changes.
Empty file.
Empty file.
59 changes: 59 additions & 0 deletions
59
regression-tests/test-results/mixed-bugfix-for-ufcs-non-local.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,59 @@ | ||
|
||
|
||
//=== Cpp2 type declarations ==================================================== | ||
|
||
|
||
#include "cpp2util.h" | ||
|
||
|
||
|
||
//=== Cpp2 type definitions and function declarations =========================== | ||
|
||
template<bool> struct t { }; | ||
constexpr bool f(const t<true>&) { return true; } | ||
constexpr t<true> o{}; | ||
|
||
// Variables. | ||
|
||
// _: <V: t<o.f()>> bool = (); // Blocked on #389, [GCC109781][]. | ||
|
||
#line 9 "mixed-bugfix-for-ufcs-non-local.cpp2" | ||
extern t<CPP2_UFCS(,,(f),(o),())> auto_9_1; | ||
|
||
extern bool auto_11_1; | ||
|
||
// Functions. | ||
|
||
// g: <V: t<o.f()>> () = { } // Blocked on [GCC109781][]. | ||
|
||
auto g(cpp2::in<t<CPP2_UFCS(,,(f),(o),())>> x) -> void; | ||
|
||
auto g() -> void; | ||
|
||
[[nodiscard]] auto h() -> t<CPP2_UFCS(,,(f),(o),())>; | ||
|
||
auto main() -> int; | ||
|
||
// [GCC109781]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109781 | ||
|
||
|
||
//=== Cpp2 function definitions ================================================= | ||
|
||
|
||
#line 9 "mixed-bugfix-for-ufcs-non-local.cpp2" | ||
t<CPP2_UFCS(,,(f),(o),())> auto_9_1 {}; | ||
|
||
bool auto_11_1 {CPP2_UFCS(,,(f),(o),())}; | ||
|
||
#line 17 "mixed-bugfix-for-ufcs-non-local.cpp2" | ||
auto g(cpp2::in<t<CPP2_UFCS(,,(f),(o),())>> x) -> void{} | ||
|
||
auto g() -> void{ | ||
cpp2::Default.expects(CPP2_UFCS(&,,(f),(o),()), ""); | ||
#line 19 "mixed-bugfix-for-ufcs-non-local.cpp2" | ||
} | ||
|
||
[[nodiscard]] auto h() -> t<CPP2_UFCS(,,(f),(o),())> { return o; } | ||
|
||
auto main() -> int{} | ||
|
2 changes: 2 additions & 0 deletions
2
regression-tests/test-results/mixed-bugfix-for-ufcs-non-local.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 @@ | ||
mixed-bugfix-for-ufcs-non-local.cpp2... ok (mixed Cpp1/Cpp2, Cpp2 code passes safety checks) | ||
|
24 changes: 0 additions & 24 deletions
24
regression-tests/test-results/mixed-bugfix-for-ufcs-sfinae.cpp
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
regression-tests/test-results/mixed-bugfix-for-ufcs-sfinae.cpp2.output
This file was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
regression-tests/test-results/pure2-bugfix-for-ufcs-sfinae.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,36 @@ | ||
|
||
#define CPP2_USE_MODULES Yes | ||
|
||
//=== Cpp2 type declarations ==================================================== | ||
|
||
|
||
#include "cpp2util.h" | ||
|
||
|
||
#line 2 "pure2-bugfix-for-ufcs-sfinae.cpp2" | ||
class B; | ||
|
||
|
||
//=== Cpp2 type definitions and function declarations =========================== | ||
|
||
#line 1 "pure2-bugfix-for-ufcs-sfinae.cpp2" | ||
template<typename T> [[nodiscard]] auto f() -> std::type_identity_t<decltype(CPP2_UFCS(,,(a),(T()),()))>; | ||
class B { | ||
public: B() = default; | ||
public: B(B const&) = delete; /* No 'that' constructor, suppress copy */ | ||
public: auto operator=(B const&) -> void = delete; | ||
|
||
#line 2 "pure2-bugfix-for-ufcs-sfinae.cpp2" | ||
}; | ||
auto main() -> int; | ||
|
||
|
||
//=== Cpp2 function definitions ================================================= | ||
|
||
#line 1 "pure2-bugfix-for-ufcs-sfinae.cpp2" | ||
template<typename T> [[nodiscard]] auto f() -> std::type_identity_t<decltype(CPP2_UFCS(,,(a),(T()),()))>{} | ||
|
||
auto main() -> int { | ||
static_assert(!(std::invocable<decltype([]<typename T>(T const& x) -> std::void_t<decltype(f<T>())>{}),B>)); | ||
} | ||
|
2 changes: 2 additions & 0 deletions
2
regression-tests/test-results/pure2-bugfix-for-ufcs-sfinae.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-ufcs-sfinae.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