https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92060
Bug ID: 92060 Summary: Alias template as template template argument confused by GCC as other template Product: gcc Version: 9.2.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: hstong at ca dot ibm.com Target Milestone: --- In the following, the alias template `Q` merely acts as a deducible template ([dcl.type.simple]) that behaves similarly to the class template `A`, it is not the same template as `A`. GCC treats `Q` as `A` for the purposes of declaration matching when used as a template template argument. ### SOURCE (<stdin>): template <template <typename> class TT> struct AA; template <typename> struct A; template <typename T> using Q = A<T>; void f(AA<A> *) { } void f(AA<Q> *) { } // GCC claims this is a redefinition of f(AA<A> *). ### COMPILER INVOCATION: g++ -fsyntax-only -std=c++2a -pedantic -Wall -Wextra -xc++ - ### EXPECTED OUTPUT: (Clean compile). ### ACTUAL OUTPUT: <stdin>:7:6: error: redefinition of 'void f(AA<A>*)' <stdin>:6:6: note: 'void f(AA<A>*)' previously defined here ### COMPILER VERSION INFO (g++ -v): Using built-in specs. COLLECT_GCC=/opt/wandbox/gcc-9.2.0/bin/g++ COLLECT_LTO_WRAPPER=/opt/wandbox/gcc-9.2.0/libexec/gcc/x86_64-pc-linux-gnu/9.2.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-9.2.0/configure --prefix=/opt/wandbox/gcc-9.2.0 --enable-languages=c,c++ --disable-multilib --without-ppl --without-cloog-ppl --enable-checking=release --disable-nls LDFLAGS=-Wl,-rpath,/opt/wandbox/gcc-9.2.0/lib,-rpath,/opt/wandbox/gcc-9.2.0/lib64,-rpath,/opt/wandbox/gcc-9.2.0/lib32 --enable-lto Thread model: posix gcc version 9.2.0 (GCC)