[all-commits] [llvm/llvm-project] 534e2d: [Clang][Interp] Visit `DecompositionDecl` and crea...
yronglin via All-commits
all-commits at lists.llvm.org
Thu Jul 25 04:44:47 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 534e2dd29f252cc13b94312895d2f4b39b54b9d4
https://github.com/llvm/llvm-project/commit/534e2dd29f252cc13b94312895d2f4b39b54b9d4
Author: yronglin <yronglin777 at gmail.com>
Date: 2024-07-25 (Thu, 25 Jul 2024)
Changed paths:
M clang/lib/AST/Interp/Compiler.cpp
M clang/test/SemaCXX/cxx1z-decomposition.cpp
Log Message:
-----------
[Clang][Interp] Visit `DecompositionDecl` and create a local variable (#100400)
The following code should be well-formed:
```C++
float decompose_complex(_Complex float cf) {
static _Complex float scf;
auto &[sre, sim] = scf;
// ok, this is references initialized by constant expressions all the way down
static_assert(&sre == &__real scf);
static_assert(&sim == &__imag scf);
auto [re, im] = cf;
return re*re + im*im;
}
```
We should visit `DecompositionDecl` and create a local variable but not
a create a dummy value directly.
---------
Signed-off-by: yronglin <yronglin777 at gmail.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list