Skip to content

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

Closed
@JohelEGP

Description

@JohelEGP

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{}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions