The following example compiles with gcc but not with clang. Which compiler is right, and why?
#include <utility>
struct Foo {
private:
template<typename T>
static int f();
public:
template<typename U>
using T = decltype(f<U>());
};
int main () {
static_assert(std::is_same_v<Foo::T<float>, int>);
}
Clang complains that 'f' is a private member of 'Foo'. I think this is not correct as f is accessed from within Foo and thus should be visible. Interestingly, it works if T is not a template.
Live code here.