https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112737
--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> --- Ah, this seems to be a general declaration matching issue not specific to modules. Here's a non-modules testcase: template<template<class> class TT, class T> decltype(TT{T()}) f(); // #1 template<template<class> class TT, class T> decltype(TT{T()}) f(); // #2, should be considered a redeclaration of #1 template<class T> struct A { A(T); }; int main() { f<A, int>(); // ambiguity error } We (wrongly?) consider the return types of the two f's to be different, because the CTAD placeholders refer to different TEMPLATE_DECLs (of a logically equivalent ttp) and structural_comptypes uses pointer identity here. Perhaps we need to relax structural_comptypes in this case.