-
Notifications
You must be signed in to change notification settings - Fork 11.6k
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
Clang parser crashes on decomposing a structured binding to a templated aggregate-like class #38496
Comments
This bug is present in clang 6, 5 and 4 (that requires -std=c++1z for c++17), so it does not block the release of 7.0.1. |
Do you by any chance have a reduced testcase that doesn't depend on boost? |
This one is difficult to reduce until llvm/llvm-bugzilla-archive#39311 is fixed because it is easy to trigger the latter, but I'm trying. |
I have reduced it (tested with "clang++ -c -std=c++17 test.cpp"):
|
The previous example is expected to fail: g++ 8.2.0 prints "error: structured binding refers to incomplete type 'A'". Here is an example that is expected to succeed (g++ 8.2.0 compiles it):
|
A bit simpler:
|
The loop is not necessary; this also crashes clang:
|
I'd bump the priority to release blocker (w.r.t. Clang 8) because the crash on a valid C++ 17 input makes it the case of not supporting the standard. |
I examined combinations of qualifications by
CV-qualification of them does not matter (as far as a code is well-formed). So, clang also crashes with, e.g., I tested on wandbox.org and clang 4.0.0–8.0.0 crashes (https://wandbox.org/permlink/euBUwdn06J1FrlWG). I hope this helps. Best. |
Fixed in trunk in r352323 and in 8 in r352356 by https://reviews.llvm.org/D56974. |
mentioned in issue #39678 |
Extended Description
The attached six lines kill clang 7 under OS X 10.14 as well as clang trunk under godbolt: https://godbolt.org/z/vnPguy
Excerpt from error message:
[...]
4 clang-7 0x0000000106cd42db clang::Sema::CheckCompleteVariableDeclaration(clang::VarDecl*) + 1555
5 clang-7 0x0000000106cd3629 clang::Sema::AddInitializerToDecl(clang::Decl*, clang::Expr*, bool) + 3471
6 clang-7 0x0000000106ef38c8 clang::Sema::BuildCXXForRangeStmt(clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, clang::Stmt*, clang::Stmt*, clang::Stmt*, clang::Expr*, clang::Expr*, clang::Stmt*, clang::SourceLocation, clang::Sema::BuildForRangeKind) + 5526
[...]
clang-7: error: unable to execute command: Segmentation fault: 11
The text was updated successfully, but these errors were encountered: