https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101221
Bug ID: 101221 Summary: Inaccurate error message for wrong template alias Product: gcc Version: 10.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: Theodore.Papadopoulo at inria dot fr Target Milestone: --- Created attachment 51062 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51062&action=edit Code showing the bug The attached code produces the following message. The reference of the 'auto' is at best surprising. Of course the code is wrong but the message is not very helpful for identifying what is wrong. mururoa-> g++ --std=c++20 test.C test.C:16:18: error: ‘auto’ not allowed in alias declaration 16 | using OtherNew = One::AClass; | ^~~ test.C:23:17: error: ‘auto’ not allowed in alias declaration 23 | using New = One::AClass; | ^~~ clang does a slightly better job and at least at namespace level explains what is wrong. mururoa-> clang++ --std=c++20 test.C test.C:16:23: error: use of class template 'One::AClass' requires template arguments using OtherNew = One::AClass; ^ test.C:4:43: note: template is declared here template <Type type,typename T> class AClass; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ test.C:23:17: error: no type named 'AClass' in namespace 'One'; did you mean 'BClass'? using New = One::AClass; ^~~~~~~~~~~ BClass test.C:18:7: note: 'BClass' declared here class BClass { ^ 2 errors generated.