Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

[BUG] Non-implicit default constructor is implicit #398

Closed

Description

Title: Non-implicit default constructor is implicit.

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

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

Commands:

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

Expected result:

public: explicit t();

Actual result and error:

public: t();
#include "cpp2util.h"

class t;
  
class t {
  public: t();

  public: t(t const&) = delete;
  public: auto operator=(t const&) -> void = delete;
};
auto main() -> int;

  t::t(){}

auto main() -> int{}

Activity

  1. ghost added
    bug
    on May 1, 2023
  2. gregmarr commented on May 1, 2023

    @gregmarr
    Contributor

    #375 (comment)

    My intent was that explicit should just be the default for converting constructors, not for copy/move constructors.

    I would assume that the default constructor would also not be explicit by default, just like copy/move.

  3. hsutter commented on May 15, 2023

    @hsutter
    Owner

    Interesting -- I wasn't familiar with explicit and default construction. This sounds right and I've changed it to emit explicit also for a non-implicit default constructor. Thanks!

  4. added a commit that references this issue on Dec 5, 2023
    ec03df5
  5. added a commit that references this issue on Feb 4, 2024
    d4647ed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions