Open JohelEGP opened 1 year ago
I started working on this, but I haven't figured out yet why calling swap
generates the CPP2_UFCS
macro instead of calling the member function.
https://github.com/hsutter/cppfront/compare/main...ntrel:cppfront:inout-that
That's because all calls of the form expression
.
function
(
expression-list arguments
)
are candidates for UFCS.
But swap is declared as a member function, so it shouldn't try UFCS. Probably somewhere else needs updating in the compiler.
No.
cppfront
doesn't implement lookup,
so it has to defer to the lowered Cpp1 code to decide it wants to use the member function.
It does that through the UFCS macro.
Title: Can't declare idiomatic
swap
.Description:
See https://github.com/hsutter/cppfront/issues/345#issuecomment-1585417506. There's code to make
swap
noexcept
by default, butthat
can only bein
ormove
, and notinout
as required byswap
.Minimal reproducer (https://cpp2.godbolt.org/z/xsx5eEfWY):
Commands:
```bash cppfront main.cpp2 clang++17 -std=c++23 -stdlib=libc++ -lc++abi -pedantic-errors -Wall -Wextra -Wconversion -I . main.cpp ```Expected result:
An idiomatic
swap
.Actual result and error:
Output: