[PATCH] D153359: [clang][Diagnostics] Fix distant source ranges in bad-conversion notes

Christopher Di Bella via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 21 11:17:29 PDT 2023


cjdb added a comment.

I like this patch, thanks for working on it 😄

In D153359#4436873 <https://reviews.llvm.org/D153359#4436873>, @hazohelet wrote:

> Consider the following code. (I added another parameter to the original code so that the covered range becomes clearer)
>
>   void func(int aa, int bb);
>   
>   
>   void test() { func(1, "two"); }
>
> BEFORE this patch:
>
>   source:4:15: error: no matching function for call to 'func'
>       4 | void test() { func(1, "two"); }
>         |               ^~~~
>   source:1:6: note: candidate function not viable: no known conversion from 'const char[4]' to 'int' for 2nd argument
>       1 | void func(int aa, int bb);
>         |      ^
>       2 |
>       3 |
>       4 | void test() { func(1, "two"); }
>         |                       ~~~~~
>
> AFTER this patch:
>
>   source:4:15: error: no matching function for call to 'func'
>       4 | void test() { func(1, "two"); }
>         |               ^~~~
>   source:1:6: note: candidate function not viable: no known conversion from 'const char[4]' to 'int' for 2nd argument
>       1 | void func(int aa, int bb);
>         |      ^            ~~~~~~

Having this in the commit message would be great, thanks!



================
Comment at: clang/lib/Sema/SemaOverload.cpp:10821
 
+    // FIXME: No test case for this. Can we remove this block?
     if (FromQs.hasUnaligned() != ToQs.hasUnaligned()) {
----------------
Please don't commit until this is resolved (either tests added or it's removed).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153359/new/

https://reviews.llvm.org/D153359



More information about the cfe-commits mailing list