Skip to content

Commit 92cbc49

Browse files
committed
fix(cpp1): emit correct UFCS in function signature
1 parent c590232 commit 92cbc49

14 files changed

+148
-32
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
template<bool> struct t { };
2+
constexpr bool f(const t<true>&) { return true; }
3+
constexpr t<true> o{};
4+
5+
// Variables.
6+
7+
// _: <V: t<o.f()>> bool = (); // Blocked on #389, [GCC109781][].
8+
9+
_: t<o.f()> = ();
10+
11+
_: bool = o.f();
12+
13+
// Functions.
14+
15+
// g: <V: t<o.f()>> () = { } // Blocked on [GCC109781][].
16+
17+
g: (x: t<o.f()>) = { }
18+
19+
g: () [[pre: o.f()]] = { }
20+
21+
h: () -> t<o.f()> = o;
22+
23+
main: () = { }
24+
25+
// [GCC109781]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109781

regression-tests/mixed-bugfix-for-ufcs-sfinae.cpp2

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
f: <T> () -> std::type_identity_t<decltype(T().a())> = { }
2+
B: type = { }
3+
main: () = {
4+
static_assert(!std::invocable<decltype(:<T> (x: T) -> std::void_t<decltype(f<T>())> = {}), B>);
5+
}

regression-tests/test-results/gcc-13/mixed-bugfix-for-ufcs-sfinae.cpp.execution renamed to regression-tests/test-results/gcc-13/mixed-bugfix-for-ufcs-non-local.cpp.execution

File renamed without changes.

regression-tests/test-results/gcc-13/mixed-bugfix-for-ufcs-sfinae.cpp.output renamed to regression-tests/test-results/gcc-13/mixed-bugfix-for-ufcs-non-local.cpp.output

File renamed without changes.

regression-tests/test-results/gcc-13/pure2-bugfix-for-ufcs-sfinae.cpp.execution

Whitespace-only changes.

regression-tests/test-results/gcc-13/pure2-bugfix-for-ufcs-sfinae.cpp.output

Whitespace-only changes.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
2+
3+
//=== Cpp2 type declarations ====================================================
4+
5+
6+
#include "cpp2util.h"
7+
8+
9+
10+
//=== Cpp2 type definitions and function declarations ===========================
11+
12+
template<bool> struct t { };
13+
constexpr bool f(const t<true>&) { return true; }
14+
constexpr t<true> o{};
15+
16+
// Variables.
17+
18+
// _: <V: t<o.f()>> bool = (); // Blocked on #389, [GCC109781][].
19+
20+
#line 9 "mixed-bugfix-for-ufcs-non-local.cpp2"
21+
extern t<CPP2_UFCS(,,(f),(o),())> auto_9_1;
22+
23+
extern bool auto_11_1;
24+
25+
// Functions.
26+
27+
// g: <V: t<o.f()>> () = { } // Blocked on [GCC109781][].
28+
29+
auto g(cpp2::in<t<CPP2_UFCS(,,(f),(o),())>> x) -> void;
30+
31+
auto g() -> void;
32+
33+
[[nodiscard]] auto h() -> t<CPP2_UFCS(,,(f),(o),())>;
34+
35+
auto main() -> int;
36+
37+
// [GCC109781]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109781
38+
39+
40+
//=== Cpp2 function definitions =================================================
41+
42+
43+
#line 9 "mixed-bugfix-for-ufcs-non-local.cpp2"
44+
t<CPP2_UFCS(,,(f),(o),())> auto_9_1 {};
45+
46+
bool auto_11_1 {CPP2_UFCS(,,(f),(o),())};
47+
48+
#line 17 "mixed-bugfix-for-ufcs-non-local.cpp2"
49+
auto g(cpp2::in<t<CPP2_UFCS(,,(f),(o),())>> x) -> void{}
50+
51+
auto g() -> void{
52+
cpp2::Default.expects(CPP2_UFCS(&,,(f),(o),()), "");
53+
#line 19 "mixed-bugfix-for-ufcs-non-local.cpp2"
54+
}
55+
56+
[[nodiscard]] auto h() -> t<CPP2_UFCS(,,(f),(o),())> { return o; }
57+
58+
auto main() -> int{}
59+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
mixed-bugfix-for-ufcs-non-local.cpp2... ok (mixed Cpp1/Cpp2, Cpp2 code passes safety checks)
2+

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

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)