https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114795
Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2024-04-23 CC| |ppalka at gcc dot gnu.org --- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> --- Reduced version of comment #6 testcase: $ cat 114795_a.H template<class T> struct A { auto f() { return 0; } }; template<class T> inline void g() { A<int> a; a.f(); } $ cat 114795_b.C template<class T> struct A { auto f() { return 0; } }; A<int> a; import "114795_a.H"; int main() { g<int>(); } $ g++ -fmodules-ts 114795_* In module ./114795-2_a.H, imported at 114795_b.C:8: 114795_a.H: In instantiation of ‘void g() [with T = int]’: 114795_b.C:11:9: required from here 11 | g<int>(); | ~~~~~~^~ 114795_a.H:9:6: error: use of ‘auto A<T>::f() [with T = int]’ before deduction of ‘auto’ 9 | a.f(); | ~~~^~ 114795_a.H:9:6: error: use of ‘auto A<T>::f() [with T = int]’ before deduction of ‘auto’ I think I have a fix -- we need to propagate an already-deduced return type during deduplication.