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

The alias-declaration of decltype lambda is broken in the for loop #63627

Closed
hewillk opened this issue Jun 30, 2023 · 4 comments
Closed

The alias-declaration of decltype lambda is broken in the for loop #63627

hewillk opened this issue Jun 30, 2023 · 4 comments
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party

Comments

@hewillk
Copy link

hewillk commented Jun 30, 2023

Clang accepts the following invalid code.

template<class T>
void f() {
  for (using U = decltype([]{}.operator----); 
       auto x : "abc") { }
};

int main() {
  f<int>();
}

https://godbolt.org/z/dTKbnv3nE

@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" and removed new issue labels Jun 30, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Jun 30, 2023

@llvm/issue-subscribers-clang-frontend

@shafik
Copy link
Collaborator

shafik commented Jun 30, 2023

If we attempt to use the type we crash: https://godbolt.org/z/KdaYW8r3h

In the non-templated case we obtain the correct diagnostic: https://godbolt.org/z/5orxWsfEc

@shafik shafik added the confirmed Verified by a second party label Jun 30, 2023
@cor3ntin
Copy link
Contributor

cor3ntin commented Jul 5, 2023

https://reviews.llvm.org/D154492 This ended up a pretty bad bug, we did not preserve the using declaration in a using statement, at all . So when doing a TreeTransform, there was nothing to transform.

The fact this was found by fuzzing is pretty funny to me :D

@cor3ntin
Copy link
Contributor

Fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party
Projects
None yet
Development

No branches or pull requests

5 participants