Skip to content

[BUG] Non-implicit multiple-argument constructor is implicit. #450

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

Closed
JohelEGP opened this issue May 11, 2023 · 0 comments
Closed

[BUG] Non-implicit multiple-argument constructor is implicit. #450

JohelEGP opened this issue May 11, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@JohelEGP
Copy link
Contributor

Title: Non-implicit multiple-argument constructor is implicit.

Description:

There are good reasons for these to also abide to the implicit specifier.
See #398 and https://quuxplusone.github.io/blog/2023/04/08/most-ctors-should-be-explicit/.

Minimal reproducer (https://cpp2.godbolt.org/z/fKWqMhWMa):

t: type = {
  operator=: (out this, x, y) = { }
}
main: () = { }

Commands:

cppfront -clean-cpp1 main.cpp2
clang++17 -std=c++2b -stdlib=libc++ -lc++abi -pedantic-errors -Wall -Wextra -Wconversion -I . main.cpp

Expected result:

  public: explicit t(auto const& x, auto const& y);

Actual result and error:

  public: t(auto const& x, auto const& y);
Cpp2 lowered to Cpp1.
#include "cpp2util.h"

class t;
  
class t {
  public: t(auto const& x, auto const& y);

  public: t(t const&) = delete; /* No 'that' constructor, suppress copy */
  public: auto operator=(t const&) -> void = delete;
};
auto main() -> int;

  t::t(auto const& x, auto const& y){}

auto main() -> int{}
@JohelEGP JohelEGP added the bug Something isn't working label May 11, 2023
JohelEGP referenced this issue Jun 17, 2023
…afunctions

Fix `@struct` to generate a type that's actually usable as a struct, by providing a metafunction a way to disable all member function generation

Make member initialization diagnostics clearer and more actionable, with better source location attribution

Lay more groundwork for generative metafunctions like `enum` and `flag_enum` that replace the entire type's contents, including to move more semantic checks to `sema.h` where they belong and will run later
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant