https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88092
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Another minimal testcase:
template<typename T>
struct S { };
template <S s> struct foo { };
template <S s>
void fn ()
{
auto t = s;
foo<t> f1;
foo<s> f2;
}