Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: recognize last uses (including of this) #887

Merged
merged 171 commits into from
Feb 4, 2024
Merged
Show file tree
Hide file tree
Changes from 130 commits
Commits
Show all changes
171 commits
Select commit Hold shift + click to select a range
709b254
fix(sema): recognize last use immediately after declaration
JohelEGP Dec 12, 2023
1cba29a
fix(sema): give function expression its own scope level
JohelEGP Dec 12, 2023
c014679
fix(sema): consider use as function in UFCS call
JohelEGP Dec 12, 2023
fc1fa52
refactor(sema): remove stale comment
JohelEGP Dec 12, 2023
286a32e
test(sema): also add unit test for `move` parameter
JohelEGP Dec 12, 2023
e3e983b
refactor(sema): avoid possible decrement beyond `begin`
JohelEGP Dec 12, 2023
d79b5d7
fix(sema): move `this` on last use
JohelEGP Dec 12, 2023
d0fd08d
test: update GCC 13 results
JohelEGP Dec 12, 2023
afb57e0
test: add Clang 18 results
JohelEGP Dec 12, 2023
a8e84ad
test: add overloads with `that`
JohelEGP Dec 12, 2023
0315e1c
test: add another case that doesn't work yet
JohelEGP Dec 12, 2023
a05c514
test: rename members to avoid shadowing
JohelEGP Dec 12, 2023
7f955f6
fix(sema): move implicit `this` of member on last use
JohelEGP Dec 12, 2023
51c80ba
test: remove commented cases that aren't last uses
JohelEGP Dec 13, 2023
257da26
fix(sema): guard check for `move this` parameter once
JohelEGP Dec 13, 2023
6397e20
test: add case for destructor
JohelEGP Dec 13, 2023
af66ec0
test: add missing GCC 13 result
JohelEGP Dec 13, 2023
d28828e
test: regenerate tests
JohelEGP Dec 13, 2023
0a4ba35
fix(sema): consider use as function in UFCS call
JohelEGP Dec 13, 2023
0ca5fdd
fix(to_cpp1): type-scope variable initialization is not deferred
JohelEGP Dec 13, 2023
b212217
refactor(util): add UFCS macros to move and forward
JohelEGP Dec 13, 2023
084fd4a
fix(to_cpp1): emit last use of function in UFCS as part of macro name
JohelEGP Dec 13, 2023
8da1f6d
test: regenerate GCC 13 result
JohelEGP Dec 13, 2023
fefe0da
fix(to_cpp1): exercise last use in range of for loop
JohelEGP Dec 13, 2023
545ea22
refactor(util): remove UFCS macros of invalid combinations
JohelEGP Dec 13, 2023
0004512
refactor(to_cpp1): handle range of for loop specifically
JohelEGP Dec 13, 2023
e82e9cd
refactor(to_cpp1): consider the expression list range
JohelEGP Dec 13, 2023
1b01804
fix(sema): apply last use to call of member function
JohelEGP Dec 13, 2023
d9f5e97
fix(sema): do not move a member function
JohelEGP Dec 13, 2023
7434fd6
fix(to_cpp1): do not move any member function
JohelEGP Dec 13, 2023
d78f5d8
test: remove non-problematic comment about double move
JohelEGP Dec 13, 2023
70cb071
refactor: regenerate `reflect.h`
JohelEGP Dec 13, 2023
927077b
refactor(sema): avoid decrementing before begin
JohelEGP Dec 13, 2023
aef69a5
fix(sema): extend implicit else branch to containing statement
JohelEGP Dec 14, 2023
c364687
fix(sema): increase scope to match an explicit else
JohelEGP Dec 14, 2023
f16d2aa
refactor(sema): move heuristic to not change ending depths
JohelEGP Dec 14, 2023
c0a8338
fix(sema): pop consecutive implicit else branches
JohelEGP Dec 14, 2023
e9cc033
refactor(parse): put implicit else statements in the actual else node
JohelEGP Dec 14, 2023
ab792e3
test: add test cases that combine implicit and explicit access
JohelEGP Dec 14, 2023
04f2115
test: add unit test for all test cases as selections
JohelEGP Dec 14, 2023
4d48cc3
fix(reflect): fix initialization and regenerate
JohelEGP Dec 14, 2023
5b6e1fd
fix(sema): apply sema phase to generated code
JohelEGP Dec 14, 2023
e0c9019
test: regenerate results
JohelEGP Dec 14, 2023
84296f6
test: add test case for another limitation
JohelEGP Dec 14, 2023
f9ec202
test: add another test case that fails
JohelEGP Dec 14, 2023
88591bb
fix(sema): improve heuristic to only move from last (implicit) `this`
JohelEGP Dec 14, 2023
7d72130
refactor(reflect): restore implicit `this` access
JohelEGP Dec 14, 2023
7f4a60f
fix(sema): do not stack an implicit else branch
JohelEGP Dec 14, 2023
0b805d7
refactor: use "implicit scope" throughout
JohelEGP Dec 14, 2023
ed9f0f5
fix(sema): use local `move this` to determine last use
JohelEGP Dec 15, 2023
83bd4f0
fix(sema): adjust condition for looking up to type
JohelEGP Dec 15, 2023
f9d0859
fix(sema): use last move on called type-scope variable
JohelEGP Dec 15, 2023
ba5309f
test: remove bogus comment
JohelEGP Dec 15, 2023
12f2a06
fix(sema): correct unset `this.` case
JohelEGP Dec 15, 2023
acd0d8f
test: reference open issue
JohelEGP Dec 15, 2023
73bd215
test: add test cases not affected by the open issue
JohelEGP Dec 15, 2023
b359d69
test: clarify FIXME comment
JohelEGP Dec 15, 2023
aece9f0
test: review the new tests
JohelEGP Dec 15, 2023
058aa3a
perf: replace `std::map` with `mutable` data member
JohelEGP Dec 15, 2023
3fb7493
refactor: add `symbol::get_final_position`
JohelEGP Dec 15, 2023
4829108
refactor(to_cpp1): do not move single named return
JohelEGP Dec 15, 2023
d36d1d2
test: add new test cases to commented out test case
JohelEGP Dec 15, 2023
d27307b
test: add similar test case to callable case
JohelEGP Dec 15, 2023
c4e06b1
refactor(sema): rework some outdated whitespace
JohelEGP Dec 15, 2023
53bb617
test: regenerate results after "do not move single named return"
JohelEGP Dec 15, 2023
5541a75
feat(sema): diagnose unused variables in generate code
JohelEGP Dec 15, 2023
ec568e4
fix(sema): consider variables in type scope declared later
JohelEGP Dec 16, 2023
969aa36
test: refactor new test to use `f_copy`
JohelEGP Dec 16, 2023
33d6adf
refactor(sema): use member token
JohelEGP Dec 16, 2023
f1254bf
refactor(sema): update comments
JohelEGP Dec 16, 2023
0e6c378
refactor(sema): use the `this` parameter exclusively
JohelEGP Dec 16, 2023
211d4ba
refactor(sema): update the comments
JohelEGP Dec 16, 2023
20ecbd4
refactor(sema): finish focusing on the implicit 'this'
JohelEGP Dec 16, 2023
36074ba
fix(to_cpp1): move returned uninitialized local
JohelEGP Dec 16, 2023
66837ee
fix(to_cpp1): move single named uninitialized return
JohelEGP Dec 16, 2023
4aa7cf1
test: add case with member declared last
JohelEGP Dec 16, 2023
2532077
refactor(sema): set condition for "at `this.`" correctly
JohelEGP Dec 16, 2023
f310ff4
fix(sema): use the better lookup algorithm for this case
JohelEGP Dec 16, 2023
5190062
fix(to_cpp1): stack current names only in namespaces
JohelEGP Dec 16, 2023
c7c829e
fix(to_cpp1): stack current names of bases
JohelEGP Dec 16, 2023
bea15a5
test: exercise forward in generated code
JohelEGP Dec 16, 2023
f632ae6
test: add stand-in for `std::move_only_function`
JohelEGP Dec 16, 2023
f628f00
test: remove bogus test case
JohelEGP Dec 16, 2023
30ac563
refactor(to_cpp1): rename to `is_class_member_access`
JohelEGP Dec 16, 2023
e42d848
test: add test case showing limitations with base members
JohelEGP Dec 16, 2023
e583502
test: actually exercise forward in generated code
JohelEGP Dec 16, 2023
cc2b62e
refactor(to_cpp1): reorder branch
JohelEGP Dec 16, 2023
2fca666
refactor(to_cpp1): remove outdated condition
JohelEGP Dec 16, 2023
8f57573
refactor(to_cpp1): rename to `is_class_member_access`
JohelEGP Dec 16, 2023
d63a0e2
fix: revert using the empty implicit else branch
JohelEGP Dec 16, 2023
4dc5175
fix(sema): change algorithm to find last uses
JohelEGP Dec 17, 2023
41a34f6
test: add test case for recursion logic
JohelEGP Dec 17, 2023
b37e32b
refactor(sema): simplify condition for UFCS on member
JohelEGP Dec 17, 2023
2af060a
test: use `f_inout` and `f_copy` in earlier test cases
JohelEGP Dec 17, 2023
9929d7d
test: enable commented out tests
JohelEGP Dec 17, 2023
18f106e
test: extend limitation unit test with alternative
JohelEGP Dec 17, 2023
27acdba
test: remove redundant explicit discards
JohelEGP Dec 17, 2023
99f5b10
test: add more test cases for the new last use algorithm
JohelEGP Dec 17, 2023
7a5b479
test: add missing `new<int>()`
JohelEGP Dec 17, 2023
80a55aa
fix: regenerate `reflect.h`
JohelEGP Dec 17, 2023
50153c4
test: add test cases of discovered problems
JohelEGP Dec 17, 2023
66d3fc6
fix(sema): pop sibling branch conditions on found last use
JohelEGP Dec 17, 2023
462ab80
refactor(sema): localize variables
JohelEGP Dec 17, 2023
b0934e8
fix(sema): recognize uses in iteration statements
JohelEGP Dec 18, 2023
e3fe1d0
fix(sema): start from the last symbol, not past-the-end
JohelEGP Dec 18, 2023
a8d13a8
refactor(sema): add local type `pos_range`
JohelEGP Dec 18, 2023
34d5f02
fix(sema): handle loops and (non) captures
JohelEGP Dec 18, 2023
249e11c
test: add similar case but without declaration
JohelEGP Dec 19, 2023
650d86f
test: regenerate results
JohelEGP Dec 19, 2023
1fe471f
fix(reflect): update and regenerate `reflect.h`
JohelEGP Dec 19, 2023
a963a88
fix(sema): start for loop at its body
JohelEGP Dec 19, 2023
43e7630
refactor(sema): use `std::span`
JohelEGP Dec 19, 2023
1e2d7bc
refactor(sema): register name deactivation at visit
JohelEGP Dec 19, 2023
03a33e6
fix(sema): do not apply use to a hiding name
JohelEGP Dec 19, 2023
0bbe08b
fix(sema): skip hiding loop parameter
JohelEGP Dec 20, 2023
5624c36
test: revert `gcc-version.output`
JohelEGP Dec 20, 2023
5fe3a02
fix(sema): recognize use in _next-clause_
JohelEGP Dec 20, 2023
41fc2eb
test: add corner case
JohelEGP Dec 20, 2023
de5df0d
fix(sema): recognize Cpp1 `using` declaration
JohelEGP Dec 20, 2023
10868b0
refactor(sema): avoid adding duplicate symbols
JohelEGP Dec 20, 2023
c854c12
refactor(sema): clarify similar members with comments
JohelEGP Dec 20, 2023
0dc41bf
refactor(sema): turn comment into code
JohelEGP Dec 20, 2023
51a81ee
refactor(sema): modify local convenience variable
JohelEGP Dec 21, 2023
f1de076
refactor(sema): remove expression scope
JohelEGP Dec 21, 2023
ce7c3fa
refactor(sema): use the right predicate
JohelEGP Dec 21, 2023
d0c9b15
refactor(sema): remove inactive, stale assertions
JohelEGP Dec 21, 2023
d032f9f
refactor(sema): keep using a sentinel
JohelEGP Dec 21, 2023
14f30ee
fix(sema): handle a nested true branch
JohelEGP Dec 21, 2023
a064f5f
refactor(sema): revert whitespace change
JohelEGP Dec 21, 2023
be1f48a
refactor(sema): fix `started_postfix_expression` simpler
JohelEGP Dec 21, 2023
b8b9cac
refactor(sema): revert stale fix of `scope_depth`
JohelEGP Dec 21, 2023
58ed0f2
refactor(sema): comment the need of `final_position` at hand-out
JohelEGP Dec 21, 2023
89941d9
refactor(to_cpp1): drop periods from comment
JohelEGP Dec 21, 2023
095be49
refactor(to_cpp1): reorder arguments for better formatting
JohelEGP Dec 21, 2023
9e0b7c4
refactor(to_cpp1): remove stale non-rvalue context
JohelEGP Dec 21, 2023
4eef0da
refactor(to_cpp1): remove useless non-rvalue context
JohelEGP Dec 21, 2023
06bc83c
refactor(to_cpp1): clarifiy comment with example
JohelEGP Dec 21, 2023
3ad7c88
Merge branch 'main' into last_use
JohelEGP Dec 21, 2023
f9ddd78
test: regenerate gcc-13 results
JohelEGP Dec 21, 2023
29fab4a
test: regenerate results
JohelEGP Dec 21, 2023
aea6971
refactor(sema): resolve CI issues
JohelEGP Dec 21, 2023
05754b3
test: revert changes to gcc-13 result
JohelEGP Dec 21, 2023
a7c1085
refactor: generalize to `identifier_sym::safe_to_move`
JohelEGP Dec 21, 2023
6a77206
test: fix implementation of `identity`
JohelEGP Dec 21, 2023
86b195a
refactor(sema): add scoped indices of uses
JohelEGP Dec 21, 2023
4694545
refactor(sema): simplify names of activation entities
JohelEGP Dec 21, 2023
4f00e57
fix(sema): do not mark non-captures as captures
JohelEGP Dec 21, 2023
f61f9f2
refactor(sema): rename to avoid verb prefix
JohelEGP Dec 21, 2023
aa6eefe
fix(sema): disable implicit move unsequenced with another use
JohelEGP Dec 21, 2023
430ec9f
fix(sema): consider _is-as-expression_ too
JohelEGP Dec 21, 2023
9e29a61
fix(sema): check all parameters for use
JohelEGP Dec 21, 2023
26a5f49
refactor(sema): remove wrong fix for UFCS issue
JohelEGP Dec 21, 2023
c49cba6
Minor updates to compile cppfront and the new test cleanly using MSVC
hsutter Jan 2, 2024
26d71c6
refactor(to_cpp1): pass `0` to `int` parameter instead of `false`
JohelEGP Jan 3, 2024
99f1556
test: discard unused results
JohelEGP Jan 3, 2024
cbd977b
refactor(to_cpp1): avoid the UFCS macro to workaround compiler bugs
JohelEGP Jan 4, 2024
241298e
test: update GCC 13 results
JohelEGP Jan 4, 2024
8764fe4
test: remove Clang 18 results
JohelEGP Jan 4, 2024
cc1516a
refactor(sema): avoid pointer arithmetic
JohelEGP Jan 4, 2024
d97a328
Merge branch 'main' into last_use
JohelEGP Jan 4, 2024
d2d0d3e
test: regenerate results
JohelEGP Jan 4, 2024
e3d17e2
refactor(sema): avoid pointer arithmetic
JohelEGP Jan 4, 2024
80f499f
Add regression test result diffs from my machine
hsutter Jan 25, 2024
84edf89
test: comment Clang 12 limitation
JohelEGP Jan 25, 2024
782e078
Merge branch 'main' into last_use
JohelEGP Jan 25, 2024
1b57ea0
test: apply CI patches
JohelEGP Jan 25, 2024
4382aa1
test: apply CI patches
JohelEGP Jan 25, 2024
7cf1093
test: apply CI patches
JohelEGP Jan 25, 2024
870df49
Tweak: Change "final position" to "global token order"
hsutter Feb 3, 2024
3b0f2c2
Minor tweaks
hsutter Feb 4, 2024
87c2344
Merge branch 'main' into last_use
hsutter Feb 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 26 additions & 23 deletions include/cpp2util.h
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ class out {
#endif
#endif

#define CPP2_UFCS_IDENTITY(...) __VA_ARGS__
#define CPP2_UFCS_REMPARENS(...) __VA_ARGS__

// Ideally, the expression `CPP2_UFCS_IS_NOTHROW` expands to
Expand All @@ -794,18 +795,18 @@ class out {
// we instead make it a template parameter of the UFCS lambda.
// But using a template parameter, Clang also ICEs on an application.
// So we use these `NOTHROW` macros to fall back to the ideal for when not using GCC.
#define CPP2_UFCS_IS_NOTHROW(QUALID,TEMPKW,...) \
#define CPP2_UFCS_IS_NOTHROW(MVFWD,QUALID,TEMPKW,...) \
requires { requires requires { std::declval<Obj>().CPP2_UFCS_REMPARENS QUALID TEMPKW __VA_ARGS__(std::declval<Params>()...); }; \
requires noexcept(std::declval<Obj>().CPP2_UFCS_REMPARENS QUALID TEMPKW __VA_ARGS__(std::declval<Params>()...)); } \
|| requires { requires !requires { std::declval<Obj>().CPP2_UFCS_REMPARENS QUALID TEMPKW __VA_ARGS__(std::declval<Params>()...); }; \
requires noexcept(CPP2_UFCS_REMPARENS QUALID __VA_ARGS__(std::declval<Obj>(), std::declval<Params>()...)); }
#define CPP2_UFCS_IS_NOTHROW_PARAM(...) /*empty*/
#define CPP2_UFCS_IS_NOTHROW_ARG(QUALID,TEMPKW,...) CPP2_UFCS_IS_NOTHROW(QUALID,TEMPKW,__VA_ARGS__)
requires noexcept(MVFWD(CPP2_UFCS_REMPARENS QUALID __VA_ARGS__)(std::declval<Obj>(), std::declval<Params>()...)); }
#define CPP2_UFCS_IS_NOTHROW_PARAM(...) /*empty*/
#define CPP2_UFCS_IS_NOTHROW_ARG(MVFWD,QUALID,TEMPKW,...) CPP2_UFCS_IS_NOTHROW(MVFWD,QUALID,TEMPKW,__VA_ARGS__)
#if defined(__GNUC__) && !defined(__clang__)
#undef CPP2_UFCS_IS_NOTHROW_PARAM
#undef CPP2_UFCS_IS_NOTHROW_ARG
#define CPP2_UFCS_IS_NOTHROW_PARAM(QUALID,TEMPKW,...) , bool IsNothrow = CPP2_UFCS_IS_NOTHROW(QUALID,TEMPKW,__VA_ARGS__)
#define CPP2_UFCS_IS_NOTHROW_ARG(...) IsNothrow
#define CPP2_UFCS_IS_NOTHROW_PARAM(MVFWD,QUALID,TEMPKW,...) , bool IsNothrow = CPP2_UFCS_IS_NOTHROW(MVFWD,QUALID,TEMPKW,__VA_ARGS__)
#define CPP2_UFCS_IS_NOTHROW_ARG(...) IsNothrow
#if __GNUC__ < 11
#undef CPP2_UFCS_IS_NOTHROW_PARAM
#undef CPP2_UFCS_IS_NOTHROW_ARG
Expand All @@ -822,41 +823,43 @@ class out {
// But using a template parameter, Clang also ICEs and GCC rejects a local 'F'.
// Also, Clang rejects the SFINAE test case when using 'std::declval'.
// So we use these `CONSTRAINT` macros to fall back to the ideal for when not using MSVC.
#define CPP2_UFCS_CONSTRAINT_PARAM(...) /*empty*/
#define CPP2_UFCS_CONSTRAINT_ARG(QUALID,TEMPKW,...) \
#define CPP2_UFCS_CONSTRAINT_PARAM(...) /*empty*/
#define CPP2_UFCS_CONSTRAINT_ARG(MVFWD,QUALID,TEMPKW,...) \
requires { CPP2_FORWARD(obj).CPP2_UFCS_REMPARENS QUALID TEMPKW __VA_ARGS__(CPP2_FORWARD(params)...); } \
|| requires { CPP2_UFCS_REMPARENS QUALID __VA_ARGS__(CPP2_FORWARD(obj), CPP2_FORWARD(params)...); }
|| requires { MVFWD(CPP2_UFCS_REMPARENS QUALID __VA_ARGS__)(CPP2_FORWARD(obj), CPP2_FORWARD(params)...); }
#if defined(_MSC_VER)
#undef CPP2_UFCS_CONSTRAINT_PARAM
#undef CPP2_UFCS_CONSTRAINT_ARG
#define CPP2_UFCS_CONSTRAINT_PARAM(QUALID,TEMPKW,...) , bool IsViable = \
#define CPP2_UFCS_CONSTRAINT_PARAM(MVFWD,QUALID,TEMPKW,...) , bool IsViable = \
requires { std::declval<Obj>().CPP2_UFCS_REMPARENS QUALID TEMPKW __VA_ARGS__(std::declval<Params>()...); } \
|| requires { CPP2_UFCS_REMPARENS QUALID __VA_ARGS__(std::declval<Obj>(), std::declval<Params>()...); }
|| requires { MVFWD(CPP2_UFCS_REMPARENS QUALID __VA_ARGS__)(std::declval<Obj>(), std::declval<Params>()...); }
#define CPP2_UFCS_CONSTRAINT_ARG(...) IsViable
#endif

#define CPP2_UFCS_(LAMBDADEFCAPT,QUALID,TEMPKW,...) \
#define CPP2_UFCS_(LAMBDADEFCAPT,MVFWD,QUALID,TEMPKW,...) \
[LAMBDADEFCAPT]< \
typename Obj, typename... Params \
CPP2_UFCS_IS_NOTHROW_PARAM(QUALID,TEMPKW,__VA_ARGS__) \
CPP2_UFCS_CONSTRAINT_PARAM(QUALID,TEMPKW,__VA_ARGS__) \
CPP2_UFCS_IS_NOTHROW_PARAM(MVFWD,QUALID,TEMPKW,__VA_ARGS__) \
CPP2_UFCS_CONSTRAINT_PARAM(MVFWD,QUALID,TEMPKW,__VA_ARGS__) \
> \
CPP2_LAMBDA_NO_DISCARD (Obj&& obj, Params&& ...params) CPP2_FORCE_INLINE_LAMBDA_CLANG \
noexcept(CPP2_UFCS_IS_NOTHROW_ARG(QUALID,TEMPKW,__VA_ARGS__)) CPP2_FORCE_INLINE_LAMBDA -> decltype(auto) \
requires CPP2_UFCS_CONSTRAINT_ARG(QUALID,TEMPKW,__VA_ARGS__) { \
noexcept(CPP2_UFCS_IS_NOTHROW_ARG(MVFWD,QUALID,TEMPKW,__VA_ARGS__)) CPP2_FORCE_INLINE_LAMBDA -> decltype(auto) \
requires CPP2_UFCS_CONSTRAINT_ARG(MVFWD,QUALID,TEMPKW,__VA_ARGS__) { \
if constexpr (requires{ CPP2_FORWARD(obj).CPP2_UFCS_REMPARENS QUALID TEMPKW __VA_ARGS__(CPP2_FORWARD(params)...); }) { \
return CPP2_FORWARD(obj).CPP2_UFCS_REMPARENS QUALID TEMPKW __VA_ARGS__(CPP2_FORWARD(params)...); \
} else { \
return CPP2_UFCS_REMPARENS QUALID __VA_ARGS__(CPP2_FORWARD(obj), CPP2_FORWARD(params)...); \
return MVFWD(CPP2_UFCS_REMPARENS QUALID __VA_ARGS__)(CPP2_FORWARD(obj), CPP2_FORWARD(params)...); \
} \
}

#define CPP2_UFCS(...) CPP2_UFCS_(&,(),,__VA_ARGS__)
#define CPP2_UFCS_TEMPLATE(...) CPP2_UFCS_(&,(),template,__VA_ARGS__)
#define CPP2_UFCS_QUALIFIED_TEMPLATE(QUALID,...) CPP2_UFCS_(&,QUALID,template,__VA_ARGS__)
#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__VA_ARGS__)
#define CPP2_UFCS_TEMPLATE_NONLOCAL(...) CPP2_UFCS_(,(),template,__VA_ARGS__)
#define CPP2_UFCS_QUALIFIED_TEMPLATE_NONLOCAL(QUALID,...) CPP2_UFCS_(,QUALID,template,__VA_ARGS__)
#define CPP2_UFCS(...) CPP2_UFCS_(&,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__)
#define CPP2_UFCS_MOVE(...) CPP2_UFCS_(&,std::move,(),,__VA_ARGS__)
#define CPP2_UFCS_FORWARD(...) CPP2_UFCS_(&,CPP2_FORWARD,(),,__VA_ARGS__)
#define CPP2_UFCS_TEMPLATE(...) CPP2_UFCS_(&,CPP2_UFCS_IDENTITY,(),template,__VA_ARGS__)
#define CPP2_UFCS_QUALIFIED_TEMPLATE(QUALID,...) CPP2_UFCS_(&,CPP2_UFCS_IDENTITY,QUALID,template,__VA_ARGS__)
#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__)
#define CPP2_UFCS_TEMPLATE_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),template,__VA_ARGS__)
#define CPP2_UFCS_QUALIFIED_TEMPLATE_NONLOCAL(QUALID,...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,QUALID,template,__VA_ARGS__)


//-----------------------------------------------------------------------
Expand Down
5 changes: 0 additions & 5 deletions regression-tests/pure2-deducing-pointers-error.cpp2
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ main: () -> int = {
pa5 := pppa**;
pa5 = 0; // caught

// TODO: @filipsajdak please take a look
// The bugfix in get_declaration_of(t) to add `&& ri->position() <= t.position()`
// to the condition is correct; it fixes issue #669 by not looking past the first
// declaration of the name in t. However, that change made the following two
// "caught" cases no longer be caught.
fun(a)++; // caught
fp := fun(a);
fp = 0; // caught
Expand Down
Loading