Skip to content

[clang][bytecode] Compile most recent function decl #131730

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

Merged
merged 1 commit into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion clang/lib/AST/ByteCode/Interp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,8 @@ static bool checkConstructor(InterpState &S, CodePtr OpPC, const Function *Func,

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

bool CallVar(InterpState &S, CodePtr OpPC, const Function *Func,
Expand Down
12 changes: 12 additions & 0 deletions clang/test/AST/ByteCode/records.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1759,3 +1759,15 @@ namespace IncompleteTypes {
}
static_assert(foo(), "");
}

namespace RedeclaredCtor {

struct __sp_mut {
void *__lx_;
constexpr __sp_mut(void *) noexcept;
};
int mut_back[1];

constexpr __sp_mut::__sp_mut(void *p) noexcept : __lx_(p) {}
constexpr __sp_mut muts = &mut_back[0];
}