Skip to content

Commit 2f808dd

Browse files
authored
[clang][bytecode] Compile most recent function decl (#131730)
We used to always do this because all calls went through the code path that calls getMostRecentDecl(). Do it now, too.
1 parent 6be6400 commit 2f808dd

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

clang/lib/AST/ByteCode/Interp.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,8 @@ static bool checkDestructor(InterpState &S, CodePtr OpPC, const Function *Func,
13641364

13651365
static void compileFunction(InterpState &S, const Function *Func) {
13661366
Compiler<ByteCodeEmitter>(S.getContext(), S.P)
1367-
.compileFunc(Func->getDecl(), const_cast<Function *>(Func));
1367+
.compileFunc(Func->getDecl()->getMostRecentDecl(),
1368+
const_cast<Function *>(Func));
13681369
}
13691370

13701371
bool CallVar(InterpState &S, CodePtr OpPC, const Function *Func,

clang/test/AST/ByteCode/records.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1759,3 +1759,15 @@ namespace IncompleteTypes {
17591759
}
17601760
static_assert(foo(), "");
17611761
}
1762+
1763+
namespace RedeclaredCtor {
1764+
1765+
struct __sp_mut {
1766+
void *__lx_;
1767+
constexpr __sp_mut(void *) noexcept;
1768+
};
1769+
int mut_back[1];
1770+
1771+
constexpr __sp_mut::__sp_mut(void *p) noexcept : __lx_(p) {}
1772+
constexpr __sp_mut muts = &mut_back[0];
1773+
}

0 commit comments

Comments
 (0)