Skip to content
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

Incorrect output when special member function is default #53

Closed
adromanov opened this issue Jul 21, 2018 · 3 comments
Closed

Incorrect output when special member function is default #53

adromanov opened this issue Jul 21, 2018 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@adromanov
Copy link

Output is incorrect when special member function is marked default outside of a class definition:

struct Base
{
    Base();
    Base(const Base &);
    ~Base();
};

Base::Base() = default;
Base::Base(const Base &) = default;
Base::~Base() = default;

Output is:

struct Base
{
	Base();
 
 ;
    Base(const Base &);
    
    ;
    ~Base() noexcept;
    ;
};

Base::Base() = default;

{
}

 = default;
Base::Base(const Base &) = default;

{
}

 = default;
Base::~Base() noexcept
{
}
 = default;
andreasfertig pushed a commit that referenced this issue Jul 22, 2018
Defaulted members outside a class lead to invalid code. The fix ensures,
that such definitions are left alone for now, as there is no code to
generate anyway.
@andreasfertig andreasfertig added the bug Something isn't working label Jul 22, 2018
@andreasfertig andreasfertig self-assigned this Jul 22, 2018
andreasfertig pushed a commit that referenced this issue Jul 22, 2018
Fixed issue #53: Defaulted special members outside a class.
@andreasfertig
Copy link
Owner

Thanks for reporting it!

@adromanov
Copy link
Author

  1. What about extra semicolons in a class definition? I believe this is not related to this issue, but still. Is there a case already for that?
  2. Maybe the output of
struct Base
{
    ~Base();
};
Base::~Base() = default;

should be

struct Base
{
    ~Base() noexcept;
};
Base::~Base() noexcept = default; // noexcept here also

instead of

struct Base
{
    ~Base() noexcept;
};
Base::~Base() = default;

I suppose it should since insights inserts noexcept to all places where it is true. What do you think about it?

@andreasfertig
Copy link
Owner

andreasfertig commented Jul 26, 2018

Hello adromanov,

  1. I belief they are also handled better with that fix.
  2. That's a good idea.

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

2 participants