https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90546
--- Comment #2 from Nick Krempel <ndkrempel at gmail dot com> --- However it's also worth noting that if you take the original snippet and change the declaration of "test" to accept a const rvalue reference instead: "void test(const Foo&&);", then gcc 9.1 (and all other gcc and clang versions tested) agree that T = const Foo in that case. So even if the standard is ambiguous, gcc is still somewhat inconsistent.