https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115609
Bug ID: 115609 Summary: Wrongly numbered ‘auto’ in diagnostics when used as template argument of a function Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jwo at jwo dot cz Target Milestone: --- Created attachment 58503 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58503&action=edit demonstration of the bug For functions declared as ‘void whats_this(foo<auto> arg)’, it is possible to cause error message with misnumbered types substituted for ‘auto’: > example.cpp: In instantiation of ‘void whats_this(foo<auto:1>) [with auto:2 = > void]’: > [...] In the message above, ‘auto:2’ should be ‘auto:1’. This is caused by placing function declarations with ‘auto’ used as a template parameter above functions causing diagnostics. Complete example with diagnostic message is provided in an attachment. No preprocessing is required. Tested with GCC commit fd536b8412d4dae42aa04739c06f99a915be6261 (the latest at the time of writing). Tested with GCC 13.2.1_p20240210.