Skip to content

Commit 44b5dca

Browse files
committed
[clang][bytecode] Compile most recent function decl
We used to always do this because all calls went through the code path that calls getMostRecentDecl(). Do it now, too.
1 parent eef5ea0 commit 44b5dca

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
@@ -1360,7 +1360,8 @@ static bool checkConstructor(InterpState &S, CodePtr OpPC, const Function *Func,
13601360

13611361
static void compileFunction(InterpState &S, const Function *Func) {
13621362
Compiler<ByteCodeEmitter>(S.getContext(), S.P)
1363-
.compileFunc(Func->getDecl(), const_cast<Function *>(Func));
1363+
.compileFunc(Func->getDecl()->getMostRecentDecl(),
1364+
const_cast<Function *>(Func));
13641365
}
13651366

13661367
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)