Issue 135522
Summary [Clang] Missing source location in diagnostic for invalid conversion in function w/ explicit object parameter
Labels clang:frontend, regression:20
Assignees
Reporter Sirraide
    Consider (https://godbolt.org/z/aa475YbW6):
```c++
struct X{};

template <typename T = void>
struct A {
    auto Error(this auto&& This) -> T {
        return T();
    }
};

struct B : A<X> {
    bool f();
};

bool B::f() {
    return Error();
}
```

Obviously, `X` isn’t convertible to `bool`, so we print an error, but the error is missing a source location:
```console
error: no viable conversion from returned value of type 'X' to function return type 'bool'
```

If I remove the explicit object parameter, we instead print
```console
<source>:15:12: error: no viable conversion from returned value of type 'X' to function return type 'bool'
   15 |     return Error();
      |            ^~~~~~~
```

This appears to be a regression since the source location *is* present in Clang 19.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to