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

C++: Clang allows a wrongly-named destructor in Templates. #56772

Closed
JFinis opened this issue Jul 28, 2022 · 2 comments
Closed

C++: Clang allows a wrongly-named destructor in Templates. #56772

JFinis opened this issue Jul 28, 2022 · 2 comments
Labels
accepts-invalid clang:frontend Language frontend issues, e.g. anything involving "Sema"

Comments

@JFinis
Copy link

JFinis commented Jul 28, 2022

The following code compiles fine on clang (14.0 and latest trunk), even though the destructor of Foobar is not called ~Foobar but ~Node. GCC reports an error as expected.

struct Node {}; 
template <int x> 
struct Foobar { ~Node() {} }; 
Foobar<5> f{};

https://godbolt.org/z/T8jTrPYW1

@tbaederr tbaederr added clang:frontend Language frontend issues, e.g. anything involving "Sema" accepts-invalid and removed new issue labels Jul 28, 2022
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 28, 2022

@llvm/issue-subscribers-clang-frontend

royjacobson added a commit that referenced this issue Aug 2, 2022
We didn't check that a destructor's name matches the directly enclosing class if the class was dependent.
I enabled the check we already had for non-dependent types, which seems to work. Added appropriate tests.

Fixes GitHub issue #56772

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D130936
@royjacobson
Copy link
Contributor

Thanks for reporting this, @JFinis! It should be fixed now https://reviews.llvm.org/D130936

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepts-invalid clang:frontend Language frontend issues, e.g. anything involving "Sema"
Projects
None yet
Development

No branches or pull requests

4 participants