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

[fuzz] Assertion `(Destructor->isDefaulted() && !Destructor->doesThisDeclarationHaveABody() && !Destructor->isDeleted()) && "DefineImplicitDestructor - call it for implicit default dtor"' failed. #22335

Closed
llvmbot opened this issue Dec 18, 2014 · 3 comments
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category worksforme Resolved as "works for me"

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Dec 18, 2014

Bugzilla Link 21961
Resolution WORKSFORME
Resolved on Oct 21, 2016 19:06
Version trunk
OS Linux
Blocks #23431
Reporter LLVM Bugzilla Contributor
CC @gburgessiv

Extended Description

Fuzzing discovered that the test case below, when given as input to

clang -fno-crash-diagnostics -std=c++11 -xc++ -c -emit-llvm

causes this assertion failure:

clang-3.6: tools/clang/lib/Sema/SemaDeclCXX.cpp:9226: void clang::Sema::DefineImplicitDestructor(clang::SourceLocation, clang::CXXDestructorDecl*): Assertion `(Destructor->isDefaulted() && !Destructor->doesThisDeclarationHaveABody() && !Destructor->isDeleted()) && "DefineImplicitDestructor - call it for implicit default dtor"' failed.

Test case:


struct A {
~A() = delete;
~A() = default;
};

@llvmbot
Copy link
Collaborator Author

llvmbot commented Dec 18, 2014

The same also goes for the constructor (though the assert is different):

struct A {
A() = delete;
A() = default;
};

clang-3.6: tools/clang/lib/Sema/SemaDeclCXX.cpp:8757: void clang::Sema::DefineImplicitDefaultConstructor(clang::SourceLocation, clang::CXXConstructorDecl*): Assertion `(Constructor->isDefaulted() && Constructor->isDefaultConstructor() && !Constructor->doesThisDeclarationHaveABody() && !Constructor->isDeleted()) && "DefineImplicitDefaultConstructor - call it for implicit default ctor"' failed.

@gburgessiv
Copy link
Member

Seems to have been fixed at some point ($clangpp is clang at r284690):

$ echo 'struct A {
~A() = delete;
~A() = default;
};' | $clangpp -fno-crash-diagnostics -std=c++11 -xc++ -c -emit-llvm -

:3:3: error: destructor cannot be redeclared
~A() = default;
^
:2:3: note: previous definition is here
~A() = delete;
^
1 error generated.

$ echo 'struct A {
A() = delete;
A() = default;
};' | $clangpp -fno-crash-diagnostics -std=c++11 -xc++ -c -emit-llvm -
:3:3: error: constructor cannot be redeclared
A() = default;
^
:2:3: note: previous definition is here
A() = delete;
^
1 error generated.

@kcc
Copy link
Contributor

kcc commented Nov 26, 2021

mentioned in issue #23431

@kcc kcc mentioned this issue Mar 28, 2015
@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 9, 2021
@Quuxplusone Quuxplusone added the worksforme Resolved as "works for me" label Jan 20, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category worksforme Resolved as "works for me"
Projects
None yet
Development

No branches or pull requests

4 participants