-
Notifications
You must be signed in to change notification settings - Fork 258
[BUG] Can't author trivial functions #547
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
As an opt-out of emitted Cpp1 Then this Cpp2:
Can lower to this Cpp1: t() = default; // 1
t() { } // 2
while (do_stuff().and_continue) { } // 3 |
I like idea, but why not other way around? = { } emits { }, and = _ emits = default, because it is already close to meaning "insert what fits here and I don't care what exactly it is" |
|
Or add a |
Title: Can't author trivial functions.
Description:
Currently, Cppfront generates special member functions even when a
=default
ed one would do.When a Cpp2
operator=
for a move/copy constructor/assignment or destructorwould perform the same operations as a
=default
ed one,it should be lowered as
=default
ed.Minimal reproducer (https://cpp2.godbolt.org/z/4nozcbdcf):
Commands:
cppfront main.cpp2 clang++17 -std=c++23 -stdlib=libc++ -lc++abi -pedantic-errors -Wall -Wextra -Wconversion -I . main.cpp
Expected result:
After uncommenting
// operator=: (move this) requires std::is_trivially_destructible_v<T> = { }
,for the assertion to pass.
Actual result and error:
Cpp2 lowered to Cpp1:
The text was updated successfully, but these errors were encountered: