mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-28 06:56:06 +00:00

Fixes https://github.com/llvm/llvm-project/issues/104810. Clang currently crashes on the following program: ``` struct S { int i; }; auto [a] = S{1}; void foo() { a; } ``` when `-fopenmp` is enabled. Because `a` is neither `VarDecl` nor `FieldDecl`. It's a `BindingDecl` that's not handled in `SemaOpenMP.cpp`'s `getCanonicalDecl`. It appears to me that this pattern matching is merely just for a refined return type of the overrides. It can also be achieved with just using the virtual `Decl::getCanonicalDecl()` instead. Do the final casting should be safe for `ValueDecl`s.
13 lines
137 B
C++
13 lines
137 B
C++
// RUN: %clang_cc1 -fopenmp -fsyntax-only %s
|
|
|
|
// expected-no-diagnostics
|
|
struct S {
|
|
int i;
|
|
};
|
|
|
|
auto [a] = S{1};
|
|
|
|
void foo() {
|
|
a;
|
|
}
|