Consider the following snippet:
struct S {
S() {}
template<typename B>
struct T {
T(B &&) {}
};
template<typename B>
T(B &&) -> T<B>;
};
int main() {
S::T t{0};
}
Clang accepts it while GCC rejects the code with the following error:
prog.cc:10:5: error: deduction guide 'S::T(B&&) -> S::T' must be declared at namespace scope
Is this valid code? Which compiler is right, GCC or Clang?