GCC shows error on this code. The code works correctly on clang and MSVC. template <class T> struct X { int foo(); }; template <class T> using foo2 = X<T>; template <class T> int foo2<T>::foo() { } error: invalid use of incomplete type 'struct X<T>'
Confirmed.
Another similar but more common (/less contrived) example, rejects-valid e.g. for GCC 10.1.0 for all C++ version (-std=c++X with X in {98, 11, 17, 2a/20}). // https://wandbox.org/permlink/aQpRzgcvAHOihKz5 template<typename T> struct S { using type = int; type f() const; }; template<typename T> using type_t = typename S<T>::type; template <typename T> type_t<T> S<T>::f() const { } // error: no declaration matches 'type_t<T> S<T>::f() const' int main() {} --- Brought up in https://stackoverflow.com/questions/65110143/using-typealias-in-place-of-typedef-defined-in-class-in-definition
*** Bug 85127 has been marked as a duplicate of this bug. ***
(In reply to David Friberg from comment #2) > Another similar but more common (/less contrived) example, rejects-valid > e.g. for GCC 10.1.0 for all C++ version (-std=c++X with X in {98, 11, 17, > 2a/20}). This is a different issue and should be filed seperately.
(In reply to Andrew Pinski from comment #4) > (In reply to David Friberg from comment #2) > > Another similar but more common (/less contrived) example, rejects-valid > > e.g. for GCC 10.1.0 for all C++ version (-std=c++X with X in {98, 11, 17, > > 2a/20}). > > This is a different issue and should be filed seperately. Thanks for the prompt Andrew. I filed Bug 101789.