https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127937

            Bug ID: 127937
           Summary: Diagnostic in function template shows wrong template
                    parameter name
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pj at patrickjohnston dot org
  Target Milestone: ---

In the code below, the error diagnostic shows:
    In instantiation of 'void f(S<BUG_BUG_BUG>)

template<typename>
struct S
{};

template<typename BUG_BUG_BUG>
using Unrelated = S<BUG_BUG_BUG>;

template<typename T0>
void f(S<T0>)
{
    static_assert(false, "^ This diagnostic shows the wrong function
prototype");
}

int main()
{
    f(S<int>());
}


Live https://godbolt.org/z/dfsG7xoxf

Seems like a stale name is being printed or some such. Looks like this has been
a bug since forever (v3.4.6 is oldest on godbolt
https://godbolt.org/z/axjevsvx1 ).

Possibly related? https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104094
  • [Bug c++/127937] New: Diagnosti... pj at patrickjohnston dot org via Gcc-bugs

Reply via email to