This is an archive of the discontinued LLVM Phabricator instance.

[Concepts] Fix an assertion failure while diagnosing constrained function candidates
ClosedPublic

Authored by royjacobson on Mar 14 2022, 3:16 PM.

Details

Summary

See: https://github.com/llvm/llvm-project/issues/54379

I tried to see if I can reuse ResolveAddressOfOverloadedFunction for explicit function instantiation and so I managed to hit this ICE.

Bug was the diagnostic required an argument (%0) and specific code path didn't pass an argument.

Diff Detail

Event Timeline

royjacobson created this revision.Mar 14 2022, 3:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 14 2022, 3:16 PM
royjacobson requested review of this revision.Mar 14 2022, 3:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 14 2022, 3:16 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

This seems acceptable to me. Though, I wonder if getTemplateArgumentBindingsText should produce the leading space, that way we could just pass the result of it directly, rather than have to create a SmallString everywhere. WDYT?

clang/lib/Sema/SemaOverload.cpp
10261

.clear shouldn't be required as you just constructed it.

This seems acceptable to me. Though, I wonder if getTemplateArgumentBindingsText should produce the leading space, that way we could just pass the result of it directly, rather than have to create a SmallString everywhere. WDYT?

There are other places (outside SemaOverload) that use this function and don't need a space, though.
I thought about just putting the space in the diagnostic itself, but then sometimes you don't get template arguments and it fails.

royjacobson marked an inline comment as done.
erichkeane accepted this revision.Mar 15 2022, 5:51 AM

This seems acceptable to me. Though, I wonder if getTemplateArgumentBindingsText should produce the leading space, that way we could just pass the result of it directly, rather than have to create a SmallString everywhere. WDYT?

There are other places (outside SemaOverload) that use this function and don't need a space, though.
I thought about just putting the space in the diagnostic itself, but then sometimes you don't get template arguments and it fails.

I see. I was hoping that wasn't the case! OK, LGTM. Let me know if you need me to commit this for you.

This revision is now accepted and ready to land.Mar 15 2022, 5:51 AM

This seems acceptable to me. Though, I wonder if getTemplateArgumentBindingsText should produce the leading space, that way we could just pass the result of it directly, rather than have to create a SmallString everywhere. WDYT?

There are other places (outside SemaOverload) that use this function and don't need a space, though.
I thought about just putting the space in the diagnostic itself, but then sometimes you don't get template arguments and it fails.

I see. I was hoping that wasn't the case! OK, LGTM. Let me know if you need me to commit this for you.

Yes, thank you :)
(with author as "Roy Jacobson <roi.jacobson1@gmail.com>")