Fix crash in indirect template instantiation. (#7240)

Provide a source location to the member expression used when a thunk
calls a member function. This ends up being used as the point of
instantiation when the return type triggers a template instantiation;
the absence of this location previously caused assertion failures within
clang.

Assisted-by: Gemini via Antigravity
This commit is contained in:
Richard Smith
2026-05-20 23:18:15 +00:00
committed by GitHub
parent f31c553e65
commit 1231098c14
2 changed files with 34 additions and 12 deletions
@@ -80,6 +80,24 @@ var x: Cpp.XY.r#type = 0;
var y: Cpp.Xint.r#type = 0;
//@dump-sem-ir-end
// --- use_indirect_class_template.carbon
library "[[@TEST_NAME]]";
import Cpp;
inline Cpp '''
template<typename T> struct wrap_iter {};
template<typename T> struct vector {
using iterator = wrap_iter<T*>;
iterator begin();
};
''';
fn F() {
var v: Cpp.vector(i32);
v.begin();
}
// CHECK:STDOUT: --- use_class_template.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {