Support pointer template params (#6810)

https://github.com/carbon-language/carbon-lang/issues/6717
This commit is contained in:
Nicholas Bishop
2026-03-02 16:07:23 +00:00
committed by GitHub
parent ef0bb898ac
commit 2389590230
5 changed files with 81 additions and 42 deletions
+10
View File
@@ -207,6 +207,16 @@ static auto ConvertArgToTemplateArg(
context.ast_context(), param_type, clang::APValue(ap_float));
return clang::TemplateArgumentLoc(template_arg, template_loc);
}
} else if (param_type->isPointerType()) {
if (auto addr_of =
context.insts().TryGetAs<SemIR::AddrOf>(const_inst_id)) {
if (auto* var_decl = GetAsClangVarDecl(context, addr_of->lvalue_id)) {
clang::TemplateArgument template_arg(var_decl, param_type);
return clang::TemplateArgumentLoc(template_arg, template_loc);
}
// TODO: support pointers to variables declared in Carbon.
}
}
}