Compiling the following code:
template <typename T> struct Outer { struct Inner { template <typename U> Outer<U> foo(); }; }; template <typename T> template <typename U> Outer<U> Outer<T>::Inner::foo() { return {}; }
Fails to compile with ICC 19.0.0.117, while it should be correct.
GCC and Clang can compile this without issues.
ICC emits the following compilation errors:
main.cpp(10): warning #2357: "Outer<U>" cannot be specified in a template member definition -- "Outer<T>" assumed instead Outer<U> Outer<T>::Inner::foo() { ^ main.cpp(10): error: declaration is incompatible with function template "Outer<U> Outer<T>::Inner::foo<U>()" (declared at line 5) Outer<U> Outer<T>::Inner::foo() { ^ compilation aborted for main.cpp (code 2)