mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user