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

            Bug ID: 111885
           Summary: source code after "required from here" note sometimes
                    printed strangely
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppalka at gcc dot gnu.org
  Target Milestone: ---

$ cat required-from-here-bug.C
template<class T> void f(typename T::type);

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

$ g++ required-from-here-bug.C
required-from-here-bug.C: In function ‘int main()’:
required-from-here-bug.C:4:9: error: no matching function for call to
‘f<int>(int)’
    4 |   f<int>(0);
      |   ~~~~~~^~~
required-from-here-bug.C:1:24: note: candidate: ‘template<class T> void
f(typename T::type)’
    1 | template<class T> void f(typename T::type);
      |                        ^
required-from-here-bug.C:1:24: note:   template argument deduction/substitution
failed:
required-from-here-bug.C: In substitution of ‘template<class T> void f(typename
T::type) [with T = int]’:
required-from-here-bug.C:4:9:   required from here
required-from-here-bug.C:1:24: note:     4 |   f<int>(0);
required-from-here-bug.C:1:24: note:       |   ~~~~~~^~~
required-from-here-bug.C:1:24: error: ‘int’ is not a class, struct, or union
type
    1 | template<class T> void f(typename T::type);
      |                        ^

The two notes following the "required from here" diagnostic seem to be
misprinted -- they refer to line 1, but show source code from line 4, which
seems like a bug?

Reply via email to